Sunday, January 30, 2011

How to Write a Macro in VS 2010


We all knows that how much friendly the macros are. Here I am showing a small example of how to write macro to Disable and Enable macros.


When debugging projects.Its difficult to add and remove break points all the time. This is a simple macro which enable and disable the Breakpoints

First thing is how to write a macro

Step1: Select Tools –> Options –> Macros –> Macro Explorer (Alt+F8)


Step2: Double click on the module created.(Here it is Module2)


Step3: Write your Macro Code


Step4 : Build the Macro code


How to add the Macro created to VS10

Step 5: go to vs10 Project(Take a new one not in Macro) Tools –> Options



Step 6: Under Environment Variables –> Keyboard –> in Show Commands containing –> Select the macro you created.



Step 7: Type the key combination then click Assign and then Ok



Finally: Go to VS and Press the key combination (in the example I shown only for Enable, for disable also do the same step)


Hope this will help you.