How to check if macro exists?

May 19, 2012 at 3:15 PM

Hi!

In VB.Net I'm using

ExcelApplication.Run("TestMacro")

to run some macro.

However, is it possible to check in advance, if this macro exists or not?

I can only think of Try / Catch Exception... is there a better solution?

Thanks,
Daniel

Coordinator
May 19, 2012 at 8:32 PM

hello,

is your macro defined in a VBA code modul or in Excel-DNA?

for VBA:

http://www.cpearson.com/excel/vbe.aspx

you can modify the Listing All Modules In A Project and Listing All Procedures In A Module tutorials.

Sebastian

May 20, 2012 at 8:53 AM

Hi Sebastian

Thank you for the quick answer! It works perfectly fine!

Daniel