<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://coreldraw.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Getting Started in VBA</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba.aspx</link><description>Step by step instructions for the various applications of the CorelDRAW family of products.</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 SP3 (Build: 36.8414)</generator><item><title>Getting Started in VBA</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba.aspx</link><pubDate>Sat, 20 Jun 2009 20:37:23 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:37</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Current revision posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 6/20/2009 4:37:23 PM&lt;br /&gt;
&lt;h2&gt;Getting Started in VBA&lt;/h2&gt;
&lt;div style="font-size: 90%;"&gt;Filed under: &lt;span style="background: SpringGreen;"&gt;VBA&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;VBA&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Editor&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;This is written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the right by&amp;nbsp;1 inch.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected, go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;&amp;nbsp;section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, normally this is the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be recorded to the new macro function.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor from 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Stop Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and press run.&lt;/p&gt;
&lt;p&gt;We seem to have a problem. &amp;nbsp;It didn&amp;#39;t change the rectangle. &amp;nbsp;Time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating. &amp;nbsp;Lets break it up:&lt;/p&gt;
&lt;p&gt;&amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; This line tells VBA that you are starting a sub routine.&amp;nbsp; All of the code for this function will exist between &amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; and &amp;quot;End Sub&amp;quot;.&amp;nbsp; The &amp;quot;()&amp;quot; represents an empty parameter list and can be used for functions which need variables.&amp;nbsp; You can think of this as passing settings for a function to use.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&amp;nbsp; Think of &amp;quot;Dim&amp;quot; as &amp;quot;declare&amp;quot;, i.e. you are stating that a variable exists.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, when we scale, the left and right side will change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operations we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was applying the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and then modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Auto-complete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &amp;quot;OrigSelection.G&amp;quot;.&amp;nbsp; You should see the following:&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;At the bottom you can see the &amp;quot;GetSize&amp;quot; function.&amp;nbsp; That is what we need.&amp;nbsp; Select it and press Space.&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The yellow tooltip tells us that the function requires two variables.&amp;nbsp; Both variables are of type Double.&amp;nbsp; Declare them by inserting the following lines after the &amp;quot;Dim OrigSelection as ShapeRange&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&lt;br /&gt;And pass these variable to your GetSize function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.GetSize w, h&lt;/p&gt;
&lt;p&gt;And finally set the new size by multiplying the current size by 2.&amp;nbsp; Modify the OrigSelection.SetSize call to look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&lt;/p&gt;
&lt;p&gt;Repeating the same steps for position we end up with the following code:&lt;/p&gt;
&lt;p&gt;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Declare all of the variables we need&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim x As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim y As Double&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&amp;nbsp;&amp;nbsp; &amp;#39; Get the active selection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&amp;nbsp; &amp;#39; tell VBA to perform operations relative to the object&amp;#39;s center&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetSize w, h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Get the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Set the width and height to 2 times the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetPosition x, y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Do the same for position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition x + 1, y&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started in VBA</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/10.aspx</link><pubDate>Sat, 20 Jun 2009 20:37:23 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:273</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 10 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 6/20/2009 4:37:23 PM&lt;br /&gt;
&lt;h2&gt;Getting Started in VBA&lt;/h2&gt;
&lt;p&gt;This is written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the &lt;span style="text-decoration: line-through; color: red;"&gt;left&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;right&lt;/span&gt; by&amp;nbsp;1 inch.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected, go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;&amp;nbsp;section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, normally this is the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be recorded to the new macro function.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor from 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Stop Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and press run.&lt;/p&gt;
&lt;p&gt;We seem to have a problem. &amp;nbsp;It didn&amp;#39;t change the rectangle. &amp;nbsp;Time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating. &amp;nbsp;Lets break it up:&lt;/p&gt;
&lt;p&gt;&amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; This line tells VBA that you are starting a sub routine.&amp;nbsp; All of the code for this function will exist between &amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; and &amp;quot;End Sub&amp;quot;.&amp;nbsp; The &amp;quot;()&amp;quot; represents an empty parameter list and can be used for functions which need variables.&amp;nbsp; You can think of this as passing settings for a function to use.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&amp;nbsp; Think of &amp;quot;Dim&amp;quot; as &amp;quot;declare&amp;quot;, i.e. you are stating that a variable exists.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, when we scale, the left and right side will change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operations we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was applying the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and then modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Auto-complete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &amp;quot;OrigSelection.G&amp;quot;.&amp;nbsp; You should see the following:&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" border="0" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;At the bottom you can see the &amp;quot;GetSize&amp;quot; function.&amp;nbsp; That is what we need.&amp;nbsp; Select it and press Space.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" border="0" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The yellow tooltip tells us that the function requires two variables.&amp;nbsp; Both variables are of type Double.&amp;nbsp; Declare them by inserting the following lines after the &amp;quot;Dim OrigSelection as ShapeRange&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&lt;br /&gt;And pass these variable to your GetSize function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.GetSize w, h&lt;/p&gt;
&lt;p&gt;And finally set the new size by multiplying the current size by 2.&amp;nbsp; Modify the OrigSelection.SetSize call to look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&lt;/p&gt;
&lt;p&gt;Repeating the same steps for position we end up with the following code:&lt;/p&gt;
&lt;p&gt;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Declare all of the variables we need&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim x As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim y As Double&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&amp;nbsp;&amp;nbsp; &amp;#39; Get the active selection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&amp;nbsp; &amp;#39; tell VBA to perform operations relative to the object&amp;#39;s center&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetSize w, h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Get the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Set the width and height to 2 times the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetPosition x, y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Do the same for position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition x + 1, y&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started in VBA</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/9.aspx</link><pubDate>Fri, 17 Apr 2009 12:59:53 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:137</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 9 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 4/17/2009 8:59:53 AM&lt;br /&gt;
&lt;h2&gt;Getting Started in VBA&lt;/h2&gt;
&lt;p&gt;This is written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the left by&amp;nbsp;1 inch.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected, go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;&amp;nbsp;section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, normally this is the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be &lt;span style="text-decoration: line-through; color: red;"&gt;saved&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;recorded&lt;/span&gt; to the &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; macro &lt;span style="background: SpringGreen;"&gt;function&lt;/span&gt;.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor from 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Stop Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and &lt;span style="text-decoration: line-through; color: red;"&gt;hit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;press&lt;/span&gt; run.&lt;/p&gt;
&lt;p&gt;We seem to have a problem. &amp;nbsp;It didn&amp;#39;t change the rectangle. &amp;nbsp;Time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating&lt;span style="text-decoration: line-through; color: red;"&gt;so&lt;/span&gt;. &amp;nbsp;Lets break it up:&lt;/p&gt;
&lt;p&gt;&amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; This line tells VBA that you are starting a sub routine.&amp;nbsp; All of the code for this function will exist between &amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; and &amp;quot;End Sub&amp;quot;.&amp;nbsp; The &amp;quot;()&amp;quot; represents an empty parameter list and can be used for functions which need variables.&amp;nbsp; You can think of this as passing settings for a function to use.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&amp;nbsp; Think of &amp;quot;Dim&amp;quot; as &amp;quot;declare&amp;quot;, i.e. you are stating that a variable exists.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, &lt;span style="text-decoration: line-through; color: red;"&gt;if&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;when&lt;/span&gt; we scale&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; the left and right side &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the &lt;span style="text-decoration: line-through; color: red;"&gt;operation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;operations&lt;/span&gt; we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was &lt;span style="text-decoration: line-through; color: red;"&gt;repeating&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;applying&lt;/span&gt; the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and &lt;span style="background: SpringGreen;"&gt;then&lt;/span&gt; modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Autocomplete&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;Auto-complete&amp;quot;&lt;/span&gt; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &amp;quot;OrigSelection.G&amp;quot;.&amp;nbsp; You should see the following:&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" border="0" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;At the bottom you can see the &amp;quot;GetSize&amp;quot; function.&amp;nbsp; That is what we need.&amp;nbsp; Select it and press Space.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" border="0" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The yellow tooltip tells us that the function requires two variables.&amp;nbsp; Both variables are of type Double.&amp;nbsp; Declare them by inserting the following lines after the &amp;quot;Dim OrigSelection as ShapeRange&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&lt;br /&gt;And pass these variable to your GetSize function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.GetSize w, h&lt;/p&gt;
&lt;p&gt;And finally set the new size by multiplying the current size by 2.&amp;nbsp; Modify the OrigSelection.SetSize call to look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&lt;/p&gt;
&lt;p&gt;Repeating the same steps for position we end up with the following code:&lt;/p&gt;
&lt;p&gt;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Declare all of the variables we need&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim x As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim y As Double&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&amp;nbsp;&amp;nbsp; &amp;#39; Get the active selection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&amp;nbsp; &amp;#39; tell VBA to perform operations relative to the object&amp;#39;s center&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetSize w, h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Get the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Set the width and height to 2 times the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetPosition x, y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Do the same for position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition x + 1, y&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started in VBA</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/8.aspx</link><pubDate>Tue, 17 Mar 2009 19:26:16 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:120</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 8 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 3/17/2009 3:26:16 PM&lt;br /&gt;
&lt;h2&gt;Getting Started &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;VBA&lt;/span&gt;&lt;/h2&gt;
&lt;p&gt;This is written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the left by&amp;nbsp;1 inch.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected, go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;&amp;nbsp;section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, normally this is the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be saved to the macro.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor from 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Stop Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and hit run.&lt;/p&gt;
&lt;p&gt;We seem to have a problem. &amp;nbsp;It didn&amp;#39;t change the rectangle. &amp;nbsp;Time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating so. &amp;nbsp;Lets break it up:&lt;/p&gt;
&lt;p&gt;&amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; This line tells VBA that you are starting a sub routine.&amp;nbsp; All of the code for this function will exist between &amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; and &amp;quot;End Sub&amp;quot;.&amp;nbsp; The &amp;quot;()&amp;quot; represents an empty parameter list and can be used for functions which need variables.&amp;nbsp; You can think of this as passing settings for a function to use.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&amp;nbsp; Think of &amp;quot;Dim&amp;quot; as &amp;quot;declare&amp;quot;, i.e. you are stating that a variable exists.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, if we scale the left and right side change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operation we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was repeating the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Autocomplete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &amp;quot;OrigSelection.G&amp;quot;.&amp;nbsp; You should see the following:&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" border="0" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;At the bottom you can see the &amp;quot;GetSize&amp;quot; function.&amp;nbsp; That is what we need.&amp;nbsp; Select it and press Space.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" border="0" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The yellow tooltip tells us that the function requires two variables.&amp;nbsp; Both variables are of type Double.&amp;nbsp; Declare them by inserting the following lines after the &amp;quot;Dim OrigSelection as ShapeRange&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&lt;br /&gt;And pass these variable to your GetSize function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.GetSize w, h&lt;/p&gt;
&lt;p&gt;And finally set the new size by multiplying the current size by 2.&amp;nbsp; Modify the OrigSelection.SetSize call to look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&lt;/p&gt;
&lt;p&gt;Repeating the same steps for position we end up with the following code:&lt;/p&gt;
&lt;p&gt;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Declare all of the variables we need&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim x As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim y As Double&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&amp;nbsp;&amp;nbsp; &amp;#39; Get the active selection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&amp;nbsp; &amp;#39; tell VBA to perform operations relative to the object&amp;#39;s center&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetSize w, h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Get the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Set the width and height to 2 times the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetPosition x, y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Do the same for position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition x + 1, y&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/7.aspx</link><pubDate>Sun, 15 Feb 2009 14:59:07 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:111</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 7 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 2/15/2009 9:59:07 AM&lt;br /&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Written&lt;/span&gt; &lt;p&gt;&lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;written&lt;/span&gt; for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the left by&amp;nbsp;1 inch.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;/strong&gt;&amp;nbsp;section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, &lt;span style="background: SpringGreen;"&gt;normally&lt;/span&gt; this is &lt;span style="text-decoration: line-through; color: red;"&gt;fine&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;usually&lt;/span&gt; the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be saved to the macro.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;from&lt;/span&gt; 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Stop Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and hit run.&lt;/p&gt;
&lt;p&gt;We seem to have &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; problem&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &amp;nbsp;It didn&amp;#39;t change the rectangle. &amp;nbsp; &lt;span style="text-decoration: line-through; color: red;"&gt;It&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;time&lt;/span&gt; &amp;nbsp;&lt;span style="background: SpringGreen;"&gt;Time&lt;/span&gt; to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating so&lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ll&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &amp;nbsp;&lt;span style="background: SpringGreen;"&gt;Lets&lt;/span&gt; break it up&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; This line tells VBA that you are starting a sub routine.&amp;nbsp; All of the code for this function will exist between &amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; and &amp;quot;End Sub&amp;quot;.&amp;nbsp; The &amp;quot;()&amp;quot; represents an empty parameter list and can be used for functions which need variables.&amp;nbsp; You can think of this as passing settings for a function to use.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&amp;nbsp; Think of &amp;quot;Dim&amp;quot; as &amp;quot;declare&amp;quot;, i.e. you are stating that a variable exists.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, if we scale the left and right side change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operation we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro&lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;second&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;time&lt;/span&gt;;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was repeating the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Autocomplete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &amp;quot;OrigSelection.G&amp;quot;.&amp;nbsp; You should see the following:&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" border="0" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;At the bottom you can see the &amp;quot;GetSize&amp;quot; function.&amp;nbsp; That is what we need.&amp;nbsp; Select it and press Space.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" border="0" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The yellow tooltip tells us that the function requires two variables.&amp;nbsp; Both variables are of type Double.&amp;nbsp; Declare them by inserting the following lines after the &amp;quot;Dim OrigSelection as ShapeRange&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&lt;br /&gt;And pass these variable to your GetSize function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.GetSize w, h&lt;/p&gt;
&lt;p&gt;And finally set the new size by multiplying the current size by 2.&amp;nbsp; Modify the OrigSelection.SetSize call to look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&lt;/p&gt;
&lt;p&gt;Repeating the same steps for position we end up with the following code:&lt;/p&gt;
&lt;p&gt;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Declare all of the variables we need&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim x As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim y As Double&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&amp;nbsp;&amp;nbsp; &amp;#39; Get the active selection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&amp;nbsp; &amp;#39; tell VBA to perform operations relative to the object&amp;#39;s center&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetSize w, h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Get the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Set the width and height to 2 times the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetPosition x, y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Do the same for position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition x + 1, y&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/6.aspx</link><pubDate>Thu, 05 Feb 2009 16:44:42 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:89</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 6 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 2/5/2009 11:44:42 AM&lt;br /&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;Written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the left by&amp;nbsp;1 inch.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;, section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, this is fine and usually the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be saved to the macro.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor for 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Stop Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and hit run.&lt;/p&gt;
&lt;p&gt;We seem to have problem, It didn&amp;#39;t change the rectangle.&amp;nbsp; It is time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating so we&amp;#39;ll break it up.&lt;/p&gt;
&lt;p&gt;&amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; This line tells VBA that you are starting a sub routine.&amp;nbsp; All of the code for this function will exist between &amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; and &amp;quot;End Sub&amp;quot;.&amp;nbsp; The &amp;quot;()&amp;quot; represents an empty parameter list and can be used for functions which need variables.&amp;nbsp; You can think of this as passing settings for a function to use.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&amp;nbsp; Think of &amp;quot;Dim&amp;quot; as &amp;quot;declare&amp;quot;, i.e. you are stating that a variable exists.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, if we scale the left and right side change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operation we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro the second time;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was repeating the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Autocomplete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;OrigSelection.G&amp;quot;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;type&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;period&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;too)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;OrigSelection.G&amp;quot;.&amp;nbsp;&lt;/span&gt; You should see &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;At the bottom you can see the &amp;quot;GetSize&amp;quot; function.&amp;nbsp; That is what we need.&amp;nbsp; Select it and press Space.&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The yellow tooltip tells us that the function requires two variables.&amp;nbsp; Both variables are of type Double.&amp;nbsp; Declare them by inserting the following lines after the &amp;quot;Dim OrigSelection as ShapeRange&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&lt;br /&gt;And pass these variable to your GetSize function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.GetSize w, h&lt;/p&gt;
&lt;p&gt;And finally set the new size by multiplying the current size by 2.&amp;nbsp; Modify the OrigSelection.SetSize call to look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&lt;/p&gt;
&lt;p&gt;Repeating the same steps for position we end up with the following code:&lt;/p&gt;
&lt;p&gt;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Declare all of the variables we need&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim x As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim y As Double&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&amp;nbsp;&amp;nbsp; &amp;#39; Get the active selection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&amp;nbsp; &amp;#39; tell VBA to perform operations relative to the object&amp;#39;s center&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetSize w, h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Get the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Set the width and height to 2 times the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetPosition x, y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Do the same for position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition x + 1, y&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/5.aspx</link><pubDate>Thu, 05 Feb 2009 16:41:39 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:85</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 5 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 2/5/2009 11:41:39 AM&lt;br /&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;Written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the left by&amp;nbsp;1 inch.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;, section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, this is fine and usually the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be saved to the macro.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor for 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Stop Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and hit run.&lt;/p&gt;
&lt;p&gt;We seem to have problem, It didn&amp;#39;t change the rectangle.&amp;nbsp; It is time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating so we&amp;#39;ll break it up.&lt;/p&gt;
&lt;p&gt;&amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; This line tells VBA that you are starting a sub routine.&amp;nbsp; All of the code for this function will exist between &amp;quot;Sub DoubleSizeAndMove()&amp;quot;&amp;nbsp; and &amp;quot;End Sub&amp;quot;.&amp;nbsp; The &amp;quot;()&amp;quot; represents an empty parameter list and can be used for functions which &lt;span style="text-decoration: line-through; color: red;"&gt;take&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;arguments&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;need&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;variables&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;You&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;think&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;passing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;settings&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;function&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&amp;nbsp; Think of &amp;quot;Dim&amp;quot; as &amp;quot;declare&amp;quot;, i.e. you are stating that a variable exists.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, if we scale the left and right side change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operation we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro the second time;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was repeating the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Autocomplete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &amp;quot;OrigSelection.G&amp;quot; (type the period too).&amp;nbsp; You should see this:&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;At the bottom you can see the &amp;quot;GetSize&amp;quot; function.&amp;nbsp; That is what we need.&amp;nbsp; Select it and press Space.&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The yellow tooltip tells us that the function requires two variables.&amp;nbsp; Both variables are of type Double.&amp;nbsp; Declare them by inserting the following lines after the &amp;quot;Dim OrigSelection as ShapeRange&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&lt;br /&gt;And pass these variable to your GetSize function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.GetSize w, h&lt;/p&gt;
&lt;p&gt;And finally set the new size by multiplying the current size by 2.&amp;nbsp; Modify the OrigSelection.SetSize call to look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&lt;/p&gt;
&lt;p&gt;Repeating the same steps for position we end up with the following code:&lt;/p&gt;
&lt;p&gt;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Declare all of the variables we need&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim x As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim y As Double&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&amp;nbsp;&amp;nbsp; &amp;#39; Get the active selection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&amp;nbsp; &amp;#39; tell VBA to perform operations relative to the object&amp;#39;s center&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetSize w, h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Get the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Set the width and height to 2 times the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetPosition x, y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Do the same for position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition x + 1, y&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/4.aspx</link><pubDate>Thu, 05 Feb 2009 16:40:18 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:84</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 4 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 2/5/2009 11:40:18 AM&lt;br /&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;Written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the left by&amp;nbsp;1 inch.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;, section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, this is fine and usually the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be saved to the macro.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor for 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Start&lt;/span&gt; &lt;strong&gt;&lt;span style="background: SpringGreen;"&gt;Stop&lt;/span&gt; Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and hit run.&lt;/p&gt;
&lt;p&gt;We seem to have problem, It didn&amp;#39;t change the rectangle.&amp;nbsp; It is time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating so we&amp;#39;ll break it up&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Sub&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;DoubleSizeAndMove(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&amp;nbsp;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;line&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tells&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;VBA&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;are&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;starting&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sub&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;routine&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;All&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;function&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;exist&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;between&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;Sub&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;DoubleSizeAndMove(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&amp;nbsp;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;End&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Sub&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;.&amp;nbsp;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;()&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;represents&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;empty&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;parameter&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;list&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;used&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;functions&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;which&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;take&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;arguments&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Think&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;Dim&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;declare&amp;quot;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;i.e&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;are&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;stating&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;variable&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;exists&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, if we scale the left and right side change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operation we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro the second time;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was repeating the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Autocomplete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &amp;quot;OrigSelection.G&amp;quot; (type the period too).&amp;nbsp; You should see this:&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;At the bottom you can see the &amp;quot;GetSize&amp;quot; function.&amp;nbsp; That is what we need.&amp;nbsp; Select it and press Space.&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The yellow tooltip tells us that the function requires two variables.&amp;nbsp; Both variables are of type Double.&amp;nbsp; Declare them by inserting the following lines after the &amp;quot;Dim OrigSelection as ShapeRange&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&lt;br /&gt;And pass these variable to your GetSize function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.GetSize w, h&lt;/p&gt;
&lt;p&gt;And finally set the new size by multiplying the current size by 2.&amp;nbsp; Modify the OrigSelection.SetSize call to look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&lt;/p&gt;
&lt;p&gt;Repeating the same steps for position we end up with the following code:&lt;/p&gt;
&lt;p&gt;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Declare all of the variables we need&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim x As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim y As Double&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&amp;nbsp;&amp;nbsp; &amp;#39; Get the active selection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&amp;nbsp; &amp;#39; tell VBA to perform operations relative to the object&amp;#39;s center&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetSize w, h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Get the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Set the width and height to 2 times the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetPosition x, y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Do the same for position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition x + 1, y&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/3.aspx</link><pubDate>Thu, 05 Feb 2009 11:50:14 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:83</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 3 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 2/5/2009 6:50:14 AM&lt;br /&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;An&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Example&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;p&gt;Written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the left by&lt;span style="text-decoration: line-through; color: red;"&gt;10&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mm&lt;/span&gt;&amp;nbsp;&lt;span style="background: SpringGreen;"&gt;1&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;inch&lt;/span&gt;.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;, section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, this is fine and usually the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be saved to the macro.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor for 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and hit run.&lt;/p&gt;
&lt;p&gt;We seem to have problem, It didn&amp;#39;t change the rectangle.&amp;nbsp; It is time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating so we&amp;#39;ll break it up.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, if we scale the left and right side change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operation we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro the second time;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was repeating the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Autocomplete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &amp;quot;OrigSelection.G&amp;quot; (type the period too).&amp;nbsp; You should see this:&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;At the bottom you can see the &amp;quot;GetSize&amp;quot; function.&amp;nbsp; That is what we need.&amp;nbsp; Select it and press Space.&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;The yellow tooltip tells us that the function requires two variables.&amp;nbsp; Both variables are of type Double.&amp;nbsp; Declare them by inserting the following lines after the &amp;quot;Dim OrigSelection as ShapeRange&amp;quot;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&lt;br /&gt;And pass these variable to your GetSize function.&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.GetSize w, h&lt;/p&gt;
&lt;p&gt;And finally set the new size by multiplying the current size by 2.&amp;nbsp; Modify the OrigSelection.SetSize call to look like this:&lt;/p&gt;
&lt;p&gt;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&lt;/p&gt;
&lt;p&gt;Repeating the same steps for position we end up with the following code:&lt;/p&gt;
&lt;p&gt;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Declare all of the variables we need&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim w As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim h As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim x As Double&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim y As Double&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&amp;nbsp;&amp;nbsp; &amp;#39; Get the active selection&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&amp;nbsp; &amp;#39; tell VBA to perform operations relative to the object&amp;#39;s center&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetSize w, h&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Get the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize w * 2, h * 2&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Set the width and height to 2 times the current width and height&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.GetPosition x, y&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Do the same for position&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition x + 1, y&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/2.aspx</link><pubDate>Thu, 05 Feb 2009 11:49:21 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:70</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 2 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 2/5/2009 6:49:21 AM&lt;br /&gt;
&lt;h2&gt;Getting Started&lt;/h2&gt;
&lt;p&gt;An Example (Written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions)&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the left by 10 mm.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;, section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, this is fine and usually the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be saved to the macro.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor for 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and hit run.&lt;/p&gt;
&lt;p&gt;We seem to have problem, It didn&amp;#39;t change the rectangle.&amp;nbsp; It is time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating so we&amp;#39;ll break it up.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, if we scale the left and right side change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operation we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro the second time;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was repeating the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Autocomplete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;OrigSelection.&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;OrigSelection.G&amp;quot;&lt;/span&gt; (type the period too).&amp;nbsp; You should see this:&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/5444.AutoComplete.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/7457.AutoComplete.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;span style="background: SpringGreen;"&gt;At&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;bottom&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;see&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;GetSize&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;function&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;That&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;what&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;need&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Select&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;press&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Space&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/4578.GetSize.jpg" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;yellow&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tooltip&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tells&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;us&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;function&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;requires&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;two&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;variables&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Both&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;variables&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;are&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;type&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Double&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Declare&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;them&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;inserting&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;lines&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;after&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;Dim&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;OrigSelection&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ShapeRange&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Dim&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;w&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Double&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Dim&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;h&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Double&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="background: SpringGreen;"&gt;And&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;pass&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;these&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;variable&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetSize&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;function&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;OrigSelection.GetSize&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;w&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;h&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;And&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;finally&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;size&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;multiplying&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;current&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;size&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;2&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Modify&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;OrigSelection.SetSize&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;call&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;look&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;like&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;OrigSelection.SetSize&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;w&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;*&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;2&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;h&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;*&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;2&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Repeating&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;same&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;steps&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;position&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;end&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;up&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Sub&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;DoubleSizeAndMove(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Declare&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;all&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;variables&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;need&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Dim&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;OrigSelection&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ShapeRange&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Dim&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;w&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Double&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Dim&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;h&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Double&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Dim&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;x&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Double&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Dim&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;y&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Double&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Set&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;OrigSelection&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ActiveSelectionRange&lt;/span&gt;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Get&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;active&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;selection&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;ActiveDocument.ReferencePoint&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;cdrCenter&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tell&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;VBA&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;perform&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;operations&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;relative&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;object&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;center&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;OrigSelection.GetSize&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;w&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;h&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Get&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;current&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;width&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;height&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;OrigSelection.SetSize&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;w&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;*&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;2&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;h&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;*&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;2&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Set&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;width&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;height&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;2&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;times&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;current&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;width&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;height&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;OrigSelection.GetPosition&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;x&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;y&lt;/span&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Do&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;same&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;position&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;OrigSelection.SetPosition&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;x&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;+&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;1&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;y&lt;/span&gt;&lt;br /&gt;&lt;span style="background: SpringGreen;"&gt;End&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Sub&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Getting Started</title><link>http://coreldraw.com/wikis/howto/getting-started-in-vba/revision/1.aspx</link><pubDate>Thu, 05 Feb 2009 11:34:47 GMT</pubDate><guid isPermaLink="false">5a13e77d-c53e-4db4-8ab6-1d57fa76cb80:69</guid><dc:creator>Hendrik Wagenaar</dc:creator><comments>http://coreldraw.com/wikis/howto/getting-started-in-vba/comments.aspx</comments><description>Revision 1 posted to How-to and Tips&amp;amp;Tricks by Hendrik Wagenaar on 2/5/2009 6:34:47 AM&lt;br /&gt;
&lt;p&gt;An Example (Written for CorelDRAW X4.&amp;nbsp; Steps may differ slightly for older versions)&lt;/p&gt;
&lt;p&gt;Lets assume that a common task that you need perform is to make an object twice as big and move it to the left by 10 mm.&amp;nbsp;&amp;nbsp; If you don&amp;#39;t already know VBA, a good place to start is to record a macro that performs the task.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;On&amp;nbsp;a new document with a rectangle selected go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A save Macro dialog will pop up.&amp;nbsp; Give your macro an appropriate name.&amp;nbsp; The name must begin with a letter and contain no spaces (e.g. DoubleSizeAndMove).&amp;nbsp; In the &lt;strong&gt;Save Macro In&lt;/strong&gt;, section, &lt;strong&gt;GlobalMacros&lt;/strong&gt; is selected by default, this is fine and usually the module you will save your macros in.&amp;nbsp; You may optionally provide a description for your macro here as well.&amp;nbsp; Press OK.&lt;/li&gt;
&lt;li&gt;You are now in Recording mode.&amp;nbsp; All actions you perform will be saved to the macro.&amp;nbsp; 
&lt;ul&gt;
&lt;li&gt;Select the rectangle with the pick tool&lt;/li&gt;
&lt;li&gt;In the property bar change the scale factor for 100% to 200%&lt;/li&gt;
&lt;li&gt;In the &lt;strong&gt;x&lt;/strong&gt;: coordinate box type &amp;quot; +&amp;nbsp;1 inch&amp;quot;&amp;nbsp;and press enter.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;go to the main menu and choose &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Start Recording&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;You have now recorded a new macro.&amp;nbsp; Lets try it out.&amp;nbsp; With your rectangle selected, go to &lt;strong&gt;Tools&lt;/strong&gt;&amp;gt;&lt;strong&gt;Macros&lt;/strong&gt;&amp;gt;&lt;strong&gt;Run Macro&lt;/strong&gt;.&amp;nbsp; A &amp;quot;Run Macro&amp;quot;&amp;nbsp;dialog will pop up.&amp;nbsp; In the &lt;strong&gt;Macros in&lt;/strong&gt;: drop down choose &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; You shoud now see an item that says &lt;strong&gt;RecordedMacros.DoubleSizeAndMove&lt;/strong&gt; (or whatever name you gave it).&amp;nbsp; Select it and hit run.&lt;/p&gt;
&lt;p&gt;We seem to have problem, It didn&amp;#39;t change the rectangle.&amp;nbsp; It is time to look at the code and see what happened.&amp;nbsp; Press &amp;quot;Alt+F11&amp;quot; to bring up the macro editor.&lt;/p&gt;
&lt;p&gt;In the project pane (left hand side), Expand &lt;strong&gt;GlobalMacros&lt;/strong&gt;.&amp;nbsp; Expand &lt;strong&gt;Modules&lt;/strong&gt;.&amp;nbsp; Double click &lt;strong&gt;RecordedMacros&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Sub DoubleSizeAndMove()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;#39; Recorded 05/02/2009&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim OrigSelection As ShapeRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set OrigSelection = ActiveSelectionRange&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ActiveDocument.ReferencePoint = cdrCenter&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetSize 2.78822, 2.78822&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; OrigSelection.SetPosition 4.005394, 7.911705&lt;br /&gt;End Sub&lt;/p&gt;
&lt;p&gt;This may look a&amp;nbsp;little&amp;nbsp;intimidating so we&amp;#39;ll break it up.&lt;/p&gt;
&lt;p&gt;&amp;quot;Dim OrigSelection As ShapeRange&amp;quot;&amp;nbsp; This line declares a variable that will be used.&amp;nbsp;&amp;nbsp;A variable&amp;nbsp;holds some data.&amp;nbsp; For example,&amp;nbsp;if you need to store a number&amp;nbsp;or&amp;nbsp;text.&amp;nbsp; In this case we&amp;#39;re storing a ShapeRange, which is&amp;nbsp;really just a collection of shapes in the document.&lt;/p&gt;
&lt;p&gt;&amp;quot;Set OrigSelection = ActiveSelectionRange&amp;quot;&amp;nbsp; This line assigns the selected shapes to the variable we declared.&lt;/p&gt;
&lt;p&gt;&amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot;&amp;nbsp; This tells VBA that all operations will be performed using the center of the object as the origin.&amp;nbsp; In other words, if we scale the left and right side change by the same amount.&lt;/p&gt;
&lt;p&gt;&amp;quot;OrigSelection.SetSize 2.78822, 2.78822&amp;quot; and&amp;nbsp; &amp;quot;OrigSelection.SetPosition 4.005394, 7.911705&amp;quot; are the operation we&amp;#39;re applying to the selection.&lt;/p&gt;
&lt;p&gt;On closer inspection of the last two lines&amp;nbsp;we see why our rectangle didn&amp;#39;t change when we ran the macro the second time;&amp;nbsp; The recorder set the size and position directly rather than multiplying the current size by 2 and moving the current position to the left by 1 inch.&amp;nbsp; Since we had already set the rectangle size and position, running the macro was repeating the exact same size and position, so nothing changed.&amp;nbsp; The Recorder is very good at doing exactly what we ask, but not very good at doing what we expect.&lt;br /&gt;&lt;br /&gt;What we need to do is modify the macro so that we first get the current size and position and modify them accordingly.&amp;nbsp; But how do we do that?&amp;nbsp; This is where VBA shines, you can often find a function you need by using the &amp;quot;Autocomplete&amp;quot; feature.&amp;nbsp; Since there is a SetSize function, maybe there is a GetSize function too?&amp;nbsp; Try this:&lt;/p&gt;
&lt;p&gt;Insert a line after &amp;quot;ActiveDocument.ReferencePoint = cdrCenter&amp;quot; and type &amp;quot;OrigSelection.&amp;quot; (type the period too).&amp;nbsp; You should see this:&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="/resized-image.ashx/__size/680x1000/__key/CommunityServer.Wikis.Components.Files/howto/5444.AutoComplete.jpg" alt="" /&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>
