PDA

View Full Version : Application.Run (RptObj.Name & "!Main") vs Application.ExecuteExcel4Macro "RUN(""Main



Pranali
01-03-2011, 12:29 AM
We have been facing an issue where our application fails with an error - "Method 'Range' of object '_Global' failed". The steps the application follows are
1. Open the workbook
2. Select a named range
3. Execute a macro using Application.Run
4. Close the workbook

The above steps execute as expected for the first run but fail if the same steps are repeated after that on an existing excel instance. On troubleshooting, we found that the error does not reproduce if the macro call is made using Application.ExecuteExcel4Macro.

This KB article details about the various methods to make an macro call but does not detail out on the differences between the two methods.

Can someone throw some light on what could be the differences in the behavior of the application if the macro call is made by Application.ExecuteExcel4Macro? Any details on the two methods would be appreciated.


Thank you.