Key Points


  • Use the Immediate window to test statements before you put them in your macro. The Immediate window is particularly useful to step through a macro that just contains variable declarations.

  • Make the most of recorded macros that assign values to object properties. You can easily convert those macros into ones that update the existing value of a property.

  • Look for additional arguments when the recorder uses a method. There may be interesting capabilities you didn’t know were available.

  • Watch for objects that are collections. They are very likely to have an Item property (to get one item), a Count property (to find out how many items are in the collection), and an Add method (to create a new item).

  • The Add method of most collections returns a reference to the item it creates. Store that item in a variable to make it easy to use later in the macro.



Microsoft Office Excel 2007 Visual Basic for Applications Step by Step
Microsoft Excel 2002 Visual Basic for Applications Step by Step (Step by Step (Microsoft))
ISBN: 0735613591
EAN: 2147483647
Year: 2004
Pages: 99
Authors: Reed Jacobsen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net