August 26, 2005

Cut down your development time.

Wanna cut down your development time?? Use macros. Iit’s really cool. I’m using it through out my coding /development process. While we do developing we used to copy n paste some of the code snippets. For example adding comments to your code or assigning getters setters to a class etc..etc.. but with macros you can do those things by using shortcut keys.. let me show you how.. You’ll love macros once you get to know it. I will explain step by step for you to create a simple macro for adding comments to your code.

You can record a macro or you can code it using visual basic.

To record a macro press Ctrl+Shift+R & then type what you want to use repeatedly(for recording). Then stop recording by pressing the Ctrl+Shift+R. To save the macro open the macro explorer by pressing Alt+F8. And rename the TemporaryMacro. If you want to edit the macro right click on the macro then click edit. You can later assign to a shortcut key by simply going to Tools > Customize > Keyboards. Its that easy ;)

Here is a sample macro which I’m using to add comments to my code. You can save it as a macro & start using it. Remember you can do lots of thing using macros not just adding code snippts ;). if you need more sample macros just send me a mail to Ludmal at gmail.com. happy coding..

'Sample code for addComments macro

Sub MyComments()
DTE.ActiveDocument.Selection.Text = "//by " + System.Environment.UserName + " " + Now()

End Sub

No comments: