Maulik Soni

<ASP:MSLOG runat=”brain”>

  Home  |   Contact  |   Syndication    |   Login
  4 Posts | 13 Stories | 15 Comments | 3 Trackbacks

News

Article Categories

Archives

Post Categories

Book List

My Contribution

Macros are used to automating repetitive task in your development environment. Macros are written using Visual Basic.NET. The same language that you write your Visual Basic.net application which can be used to automate repetitive tasks. Macros still use commands to represent task in the .net IDE. But when you write customization to these Macros, you can write them in the same Visual Basic.net code.

The easiest way to automate a task is to record a series of steps in the IDE and then play them back when you need that.

  1. In visual studio choose Tools,Macros, Record Temp Macro (ctrl+Shift+R)
  2. Type the block of text as you would like it to appear.
  3. Choose tools,macro, stop recording(ctrl+shift+R) to stop the recording.
  4. For now you can press (ctrl+shift+p) to play temp macro.
  5. You can see the recorded macro using macro explorer(ALT+F8)

Adding a dynamic desc - you can use inputbox() to ask user to enter text.

Also use DTE.ActiveDocument.Name kind of methods which return dynamic value.

To save a Macro

  1. go to tools,macro,save temp maco

There are couple of ways we can invoke our macro. You can open the command window(ctrl+alt+a)

by choosing view,other window,command window. To run the macro from command window enter the fully qualified name of the macro. Macros.MyMacros.RecordingModule.comments

you can add it to tool bar button or menu shortcut. Mapping macros to a keyboard shortcut. Frequently used macros can be mapped to keystrokes or tool bars. To map any macro to keyboard, choose tools,options,environment,keyboard. Type macro command name, select macro, assign shortcut.

To add it to tool bar right click ide tool bar and select the customize context menu item. Go to command tab, select macro->select your macro. Now drag it to the tool bar. To change the image of macro right click on newly placed macro button on tool bar.

posted on Saturday, March 18, 2006 1:11 PM