Hi everyone:

I'm calling an Excel file from C#; now, because I Want to run automatically a Macro, I've added to my Workbook code, Private Sub Workbook_Open() the name of the routine I want VBA to execute as soon as the file is open.

The problem is that C# is about to copy the data into the main Spreadsheet but VBA keeps running before all my data has been copied....

I've tried, loops, selecting one cell and make a loop until the last data is <>"" in order to keep running the program; pausing the VBA code for a couple of seconds but nothing seems to work....

I don't know if C# will pause until the VBA code finish executing and then continues...

Or is there a way to create a break of the code for a couple of seconds and then resume the Macro?

Any suggestions? Is there a way to call a Macro from C#? So that I could copy all the data and then call the Macro from C#?



9 Years
Discussion Span
Last Post by carlos_lopez_m
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.