vbcsript calls excel macro

G

Guest

Hi,

I have a simple script that should open a workbook, run a macro and save the
file. Everything except the macro part works fine. The file opens and saves
but macro does not run. Can someone please advise me what am I doing wrong.
Below is the script.
Thanks

Dim objExcel
Dim objWorkBook
Set objExcel = CreateObject("EXCEL.APPLICATION")
Set objWorkBook = objExcel.Workbooks.Open("C:\File1.xls")
objExcel.DisplayAlerts=False
objExcel.Run "PERSONAL.xls!FORMAT"
objWorkBook.SaveAs "C:\file2.xls",44
objExcel.DisplayAlerts=True
objWorkBook.Close True
objExcel.Quit
Set objWorkBook = Nothing
Set objExcel = Nothing
 
B

Bob Phillips

Open Personal.xls as well, it is not opened when running Excel in
automation.

--
HTH

Bob Phillips

(remove xxx from email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top