need help: Open Excel, run macro, save file, close Excel 
Author Message
 need help: Open Excel, run macro, save file, close Excel

If anyone can help me write this simple script, I would appreciate it:
 I would like the script to open an excel file ("books.xls"), run a macro in
the excel file, save the file after the macro does its business, then exit
excel.

TIA
Chris.
cdinardo -dot- agoron -dot- com



Tue, 13 Feb 2001 03:00:00 GMT  
 need help: Open Excel, run macro, save file, close Excel
Answering my own question if some trial and error:

Set objXL = WScript.CreateObject("Excel.Application")
objXL.Application.Visible = True
objXL.workbooks.open "c:\my documents\book.xls"
objXL.Application.Run "macro1"
objXL.Save
objXL.Application.Quit
Set objXL = Nothing

Quote:

>If anyone can help me write this simple script, I would appreciate it:
> I would like the script to open an excel file ("books.xls"), run a macro
in
>the excel file, save the file after the macro does its business, then exit
>excel.

>TIA
>Chris.
>cdinardo -dot- agoron -dot- com



Thu, 15 Feb 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Opening an excel file through a form/running excel macros through access

2. Close and Save Open Excel File

3. saving and closing opened excel file in VB

4. during running a excel-macro save a file every hour

5. Help Excel97 macro to run on file open or close

6. save excel file as csv format as part of macro

7. Open Excel Spreadsheet, Save, Close

8. Outlook VBA - open Excel, read in two fields, send email with these, close excel

9. Excel 2000 crashes when running macros created in Excel 97

10. Saving Excel file to Excel file

11. Running an excel macro using excel 8 obj lib

12. Running an excel macro using excel 8 obj lib

 

 
Powered by phpBB® Forum Software