claudehenri
Technical User
Hi
I'm tying to save a file which is opened from a template. When the SaveAs is executed (the last line) I get this error. I've got no idea?
Run-Time Error '-2147417848 (80010108)':
Automation Error
The object invoked has disconnected from its clients.
Sub SaveCrane()
With SaveFile
For Each Item In Worksheets
'set printareas for each worksheet, here
Next Item
End With
1 SaveFileName = Application.GetSaveAsFilename
(CraneProject, FileFilter:="Microsoft
Excel Workbook (*.xls), *.xls",
Title:="Save Data File")
Temp = Right(SaveFileName, Len(SaveFileName) -
InStrRev(SaveFileName, "\"))
For l = 1 To Workbooks.Count
If Workbooks(l).Name = Temp Then
ReplaceFile = MsgBox("A file of this name is already
open!, do you wish to close this
file in order to save under this
name?", vbYesNo + vbDefaultButton2)
If ReplaceFile = vbYes Then
Workbooks(l).Close
Exit For
Else
GoTo 1
End If
End If
Next l
With Application.FileSearch
.LookIn = Left(SaveFileName,
InStrRev(SaveFileName, "\"))
.Filename = Temp
If .Execute = 1 Then
ReplaceFile = MsgBox("Do you wish to replace the
file", vbYesNo + vbDefaultButton2)
If ReplaceFile = vbNo Then GoTo 1
End If
End With
If Temp <> False Then SaveFile.SaveAs _
Filename:=SaveFileName
End Sub
I'm tying to save a file which is opened from a template. When the SaveAs is executed (the last line) I get this error. I've got no idea?
Run-Time Error '-2147417848 (80010108)':
Automation Error
The object invoked has disconnected from its clients.
Sub SaveCrane()
With SaveFile
For Each Item In Worksheets
'set printareas for each worksheet, here
Next Item
End With
1 SaveFileName = Application.GetSaveAsFilename
(CraneProject, FileFilter:="Microsoft
Excel Workbook (*.xls), *.xls",
Title:="Save Data File")
Temp = Right(SaveFileName, Len(SaveFileName) -
InStrRev(SaveFileName, "\"))
For l = 1 To Workbooks.Count
If Workbooks(l).Name = Temp Then
ReplaceFile = MsgBox("A file of this name is already
open!, do you wish to close this
file in order to save under this
name?", vbYesNo + vbDefaultButton2)
If ReplaceFile = vbYes Then
Workbooks(l).Close
Exit For
Else
GoTo 1
End If
End If
Next l
With Application.FileSearch
.LookIn = Left(SaveFileName,
InStrRev(SaveFileName, "\"))
.Filename = Temp
If .Execute = 1 Then
ReplaceFile = MsgBox("Do you wish to replace the
file", vbYesNo + vbDefaultButton2)
If ReplaceFile = vbNo Then GoTo 1
End If
End With
If Temp <> False Then SaveFile.SaveAs _
Filename:=SaveFileName
End Sub