Rick_Stanich
Technical User
Hello
I am trying to save an open (active) Excel file to a new location automatically.
I created a VBS program, which I wrote initially in VBA but I am loosing something when using VBS.
The SaveAs portion will not complete and gives no errors or warning.
I am temporarily using a MsgBox to see if I do get the file name.
The VBS program will be activated by PCM (A CMM programming language).
Any help with this is appreciated.
Regards.
I am trying to save an open (active) Excel file to a new location automatically.
I created a VBS program, which I wrote initially in VBA but I am loosing something when using VBS.
The SaveAs portion will not complete and gives no errors or warning.
I am temporarily using a MsgBox to see if I do get the file name.
The VBS program will be activated by PCM (A CMM programming language).
Code:
Dim objXL, strMessage
On Error Resume Next
Set objXL = GetObject(,"Excel.Application")
If Not TypeName(objXL) = "Empty" then
'strMessage = "Excel Running"
MsgBox "The active workbook name is " & objXL.ActiveWorkbook.Name 'for testing, retrieves active workbook name ok
objXL.SaveAs "C:\Users\Public\Documents\Zeiss\CALYPSO\workarea\results\Excel Files" & "\" & objXL.ActiveWorkbook.Name 'this line fails to save as
Else
MsgBox "No active Excel file open."
End If
Any help with this is appreciated.
Regards.