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 3 Years Ago by happygeek: moved

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 3 Years Ago 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 article has been dead for over six months. Start a new discussion instead.