ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error on Save As (https://www.excelbanter.com/excel-programming/374430-error-save.html)

Graham Y

Error on Save As
 
Hi This is driving me nuts!
I am working on a file I want to save as an xlt, and once the user has
entered all the data on the form I want them to click a button that will
result in the file being printed, saved, emailed and closed. print & email
sorted, but saving is giving me grief!
I looked at other posts, and I copied some neat code to get up a chose
folder dialog box, and then I add the file name (from a couple of cells) and
currently use:
ThisWorkbook.SaveAs Filename:=path & "\" & client
Excel then crashes and closes.
Run Time Error '2147417848(80010108)'
Automation Error The Object has disconected from its client

Please what am I doing wrong!
TIA
Graham Y


Dion

Error on Save As
 
Graham - perhaps something is wrong with your path/client variables?
I tried this and it works for me:

Sub zzz()
Dim path As String, client As String
path = "c:\temp"
client = "z.xls"
ThisWorkbook.SaveAs Filename:=path & "\" & client
End Sub

try seeing what your Filename variable is - enter this before your SaveAs
line:
msgbox path & "\" & client
this will visually show you what you are passing to the SaveAs object -
perhaps it's not quite what you think it is.




"Graham Y" wrote:

Hi This is driving me nuts!
I am working on a file I want to save as an xlt, and once the user has
entered all the data on the form I want them to click a button that will
result in the file being printed, saved, emailed and closed. print & email
sorted, but saving is giving me grief!
I looked at other posts, and I copied some neat code to get up a chose
folder dialog box, and then I add the file name (from a couple of cells) and
currently use:
ThisWorkbook.SaveAs Filename:=path & "\" & client
Excel then crashes and closes.
Run Time Error '2147417848(80010108)'
Automation Error The Object has disconected from its client

Please what am I doing wrong!
TIA
Graham Y


Graham Y

Error on Save As
 
It appears that there is a bug in VBA. I looked up the error code and it
suggests it has to do with late binding, in VB projects, and it looks as if
this is a related problem, even without doing the save as just using a
msgbox, when I quit the app I cannot get to another module or form by double
clicking it in the VBA IDE.
I've tried to install updates but it's asking for my Office disk, which I
can't find! I'll have to keep hunting, or do this at work not home!

But thanks for the suggestion.

"Dion" wrote:

Graham - perhaps something is wrong with your path/client variables?
I tried this and it works for me:

Sub zzz()
Dim path As String, client As String
path = "c:\temp"
client = "z.xls"
ThisWorkbook.SaveAs Filename:=path & "\" & client
End Sub

try seeing what your Filename variable is - enter this before your SaveAs
line:
msgbox path & "\" & client
this will visually show you what you are passing to the SaveAs object -
perhaps it's not quite what you think it is.




"Graham Y" wrote:

Hi This is driving me nuts!
I am working on a file I want to save as an xlt, and once the user has
entered all the data on the form I want them to click a button that will
result in the file being printed, saved, emailed and closed. print & email
sorted, but saving is giving me grief!
I looked at other posts, and I copied some neat code to get up a chose
folder dialog box, and then I add the file name (from a couple of cells) and
currently use:
ThisWorkbook.SaveAs Filename:=path & "\" & client
Excel then crashes and closes.
Run Time Error '2147417848(80010108)'
Automation Error The Object has disconected from its client

Please what am I doing wrong!
TIA
Graham Y



All times are GMT +1. The time now is 05:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com