In Vsto-excel project , i have a macro in a particular module. By code in c#, i want to launch the VBA editor showing the given macro. i know the interop concepts , but i m stuck at launching the vba editor and showing the particular macro.
Asked
Active
Viewed 2,494 times
2 Answers
5
You can use Application.Goto "MarcoName"
which will open up the VBE at the sub / macro you specify.

Francis Dean
- 2,386
- 2
- 22
- 29
-
yes that worked fine ,.... but if i am having 2 workbooks opened and both have the macro with same name ...then active workBook's macro is called ?? – KhannaB7 Oct 09 '12 at 15:31
0
The keyboard shortcut ALT + F11 on a open excel sheet ,opens the VBA Editor by default. Use the excel interop to open the excel and make the excel window visible .Then you can pass the keyboard shortcut to the excel window,from your application.
If you are using this on a winform application ,you can use the sendkeys method to pass the keyboard shortcut to the excel window. http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx
otherwise use the sendmessage method to pass the keyboard shortcut across.Here is the so post on the sendmessage usage , c# Sending keyboard commands to another window / process.

Community
- 1
- 1

Prabhu Murthy
- 9,031
- 5
- 29
- 36