1

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.

2 Answers 2

5

You can use Application.Goto "MarcoName" which will open up the VBE at the sub / macro you specify.

Sign up to request clarification or add additional context in comments.

1 Comment

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 ??
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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.