View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_14_] Bob Phillips[_14_] is offline
external usenet poster
 
Posts: 216
Default vbcsript calls excel macro

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)

"vedran" wrote in message
...
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