Openning excel file and execute macro & parameters 
Author Message
 Openning excel file and execute macro & parameters

Hello everyone,

I have to make a program in VB. This program has to open
an Ms Excel file and run a macro. This macro may be
different depending the task I have to do. I know how to
use "auto_open" and autoexecute macro. For now I use the
following code to start Excel and openning my file:

    Public XL As Object

    TEMPLATE = "C:\COMMLOG\COMMLOG.XLS"

    Set XL = GetObject(TEMPLATE)

    XL.Application.Visible = True

    Set XL = Nothing

Also for those guys who are not newbie like me. I would
like to how to start Excel (to open an Excel file) with
parameters (if possible).

Thank you.



Sat, 20 Dec 2003 08:36:39 GMT  
 Openning excel file and execute macro & parameters
When you open Excel using Automation through GetObject or CreateObject,
there is no option to pass command-line parameters such as a macro to run.

I would suggest:
1. open Excel using Automation as you are doing
2. don't use auto_open macros
3. execute the desired macro from your VB code using the Run method of the
Excel Application object.   See Q177760.



Thu, 25 Dec 2003 00:40:18 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. openning excel file

2. openning excel file

3. openning excel file

4. Running a word Macro & an excel macro

5. Execute Excel Macro from Access

6. Execute an excel macro from outlook

7. Executing Excel Macros from Word

8. Error 40038 - Using VB 4.0 16 bits when executing Excel Macros

9. Executing Excel Macros inside VB 4.0

10. Executing User Defined Excel Macros

11. Help needed: problem when executing an Excel macro from an asp page

12. How to Execute Macro Excel from vbscript?

 

 
Powered by phpBB® Forum Software