Hello group; I have been searching for a way to run an external macro on an excel sheet automatically. I have found some code including this local suggestion http://www.daniweb.com/software-development/vbnet/threads/332821/run-excel-macros-with-vb.net# which looks good but I am baffled by the final instruction "just remember that you have to have an excel sheet with a macro named TheNetMacro or any other name you want to give it."
Where is this excel sheet stored so that it may be invoked just by entering its name a a parameter in a function call, as shown here? I would be most grateful for any guidance in this regard... Thanks in advance, -Patrick

Edited by happygeek: moved

5 Years
Discussion Span
Last Post by patrick.weaver.161

Basically he's telling you the parameters of the sub routine. The path to the excel file and the name of the macro, in the excel sheet in that file , you want to run. Make sure you read his comment about imports in order to run his routine.

Edited by tinstaafl


Hello and thanks for your help with this. I have the imports taken care of and my app already selects and opens an excel workbook. My goal is to open a second workbook (The 'PERSONAL' book where I propose to keep the macros) and run macros from that workbook on the first workbook. I am baffled by this code because it only seems to open the one file. I am trying to automate the task of running the same macro on a different workbook. When we do this by hand, Excel asks us where the macro is that we want to run("this workbook/all open workbooks") but I don't know how I would do this same task automatically from an app...


I expect that the command I need looks something like xlWorkbookA.Run(xlWorkbookB.MacroX)but I am not familiar enough with VB.Net to set this up on my own...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.