troubleshooting Question

Save an excel file from within a vbscript

Avatar of cbones
cbonesFlag for United States of America asked on
VB ScriptMicrosoft ExcelMicrosoft Office
10 Comments1 Solution9341 ViewsLast Modified:
Thanks in advance for any help or guidance.   I have a vbscript, pasted below, that opens excel, runs a macro but fails to save and close.

Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.Workbooks.Open(“M:\Test\Test.csv”)

objExcel.Application.Visible = True


objExcel.Application.Run "PERSONAL.XLSB!Macro1"
objExcel.ActiveWorkbook.Close

'objWorkbook.SaveAs(“M:\Test\Test.csv”)
objExcel.Application.Quit
WScript.Quit

I've commented out the objWorkbookSaveAs because it pops up an invalid charater in line 10 - char 20.  Is it because it is located on a network drive?  I can manually save the file.

Thank you
ASKER CERTIFIED SOLUTION
NorieSenior Associate
Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros