• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

7. Macro Hacks > 63. Use Word Dialogs in a Macro

Use Word Dialogs in a Macro

Using Word’s own dialogs in your macros allows the person using the macros to work with a familiar interface, which can make even complicated macros seem easy to use.

Macros that must interact with the person using them are generally harder to write than those that just run from start to finish without needing any user input. In many cases, however, Microsoft has already done the work of designing a useful interface for modifying the same sorts of things your macro probably does (i.e., parts of a Word document).

For example, if you’ve got a macro that inserts a particular kind of table into your document, you might want to let the user choose the number of rows and columns to put in the table each time the macro is run. Rather than create your own user form in the Visual Basic Editor, you can use Word’s InsertTable dialog—just show the dialog and capture the row and column numbers selected, and your macro can insert the right-sized table.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint