I have recently written a macro for visual studio 2010 in the macro IDE, I have saved the macro and it is in my current active macro project in my solution.
when going to add the macro to my tool bar via
Tools > Customize > Commands (tab) > toolbar > Standard > Add Command > Macro
Only Macro.Sample.etc… are present and none of my macros. what am I missing?
I went into Tools > Macros explorer and set my current project to the default recording project.
VS makes this horribly confusing. What you created was a Macro Module – a container for your Macro. However, if the module name doesn’t match the filename, it will NOT “register” with or be seen by the system. You can create all the subs you want, but they wont show up (or “register” themselves as a useable Macro).
Answer:
Check to be sure “Public Module Blah” matches the filename (Module Name in Explorer)!
You can get bitten by this by creating a new module, and then copy/paste code from somewhere else but not realizing that the module names are different.
Follow these steps if you want to be SURE that your module will work as expected:
Build, Save, check your Toolbar / Add Command, and you will see your macro!
You can rename the subs, thats ok. Those become your usable macros. But DON’T rename the module! Get the module name the way you want it at the time you create it.