Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

vbscript start excel then run macro not working

Status
Not open for further replies.

khstng50

Programmer
Mar 18, 2010
1
US
I am trying to run a vbscript that opens excel then executes a macro. I have code that works but I get an error saying "The macro "sort" can not be found. I found that if you open excel by the script it does not load any of the macros. I did some searching and found that by opening excel via automation does not load all addins and startup files to load quicker. Is there something that I can put in the script that will load the macro files? Here is what I have for the script.

Code:
filePath = "C:\Scripts\capplot\utilization.csv"
Set oExcel = CreateObject("Excel.Application")
oExcel.Workbooks.Open(filepath)
oExcel.Visible = True
oExcel.Run "utilization"
oExcel.ActiveWorkbook.Save
oExcel.ActiveWorkbook.Close
oExcel.Quit
Set oExcel = Nothing

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top