Alan Kirk
August 4th, 1999, 09:26 AM
I'm using VBScript (via WSH 1.0) to load an existing EXCEL workbook template (.xlt), makes a few changes to it's contents, then attempts to use .SaveAs to save it to disk with the path+filename specified as a Variant. See code below.
objXL.Workbook(CurrentWorkbook).Activate
objXL.Worksheets("MyPage").Activate
objXL.ActiveWorkbook.SaveAs NewAppDocName
IF (Err.Number <>0) then
Call ReportError("Can't SAVE requested workbook !!",NewAppDocName)
End IF
As VBScipt is late binding it seems not to allow NamedArguments like VB.
If the variant NewAppDocName is replaced with a string literal like .SaveAs "A1" then it works!! Also, placing a " before & after the filename contained in the variant doesn't work either.
If this can't be done using SaveAs, is it possible to change to name of the workbook, then call .Save (same end result that I'm after).
Any help is much appreciated, especially after spending days on this problem!!
AK
objXL.Workbook(CurrentWorkbook).Activate
objXL.Worksheets("MyPage").Activate
objXL.ActiveWorkbook.SaveAs NewAppDocName
IF (Err.Number <>0) then
Call ReportError("Can't SAVE requested workbook !!",NewAppDocName)
End IF
As VBScipt is late binding it seems not to allow NamedArguments like VB.
If the variant NewAppDocName is replaced with a string literal like .SaveAs "A1" then it works!! Also, placing a " before & after the filename contained in the variant doesn't work either.
If this can't be done using SaveAs, is it possible to change to name of the workbook, then call .Save (same end result that I'm after).
Any help is much appreciated, especially after spending days on this problem!!
AK