Question saving excel file

ulynen

Member
Joined
Feb 18, 2015
Messages
22
Programming Experience
5-10
I have created a brand new excel book. I've added a sheet and named it. now I want to save the file, but I can't seem to get it to work.

' xlBook.SaveAs(gstrExcel_Path & "CallerID.xlsx")

This is the error I get. what I don't understand is the number D94B8010 that is at the end of the path it's not part of the string value.
'{"Microsoft Excel cannot access the file 'c:\users\default\desktop\D94B8010'. There are several possible reasons:
'? The file name or path does not exist.
'? The file is being used by another program.
'? The workbook you are trying to save has the same name as a currently open workbook."}
 
the path is set to 'c:\users\default\desktop\'

I've tried to use xlbook.saveas(
gstrExcel_Path & "callerid.xlsx") and xlbook.saveas("c:\users\default\desktop\callerid.xlsx")
they both generate the same error.
is there a setting in the IDE that determines the path for saved files which cannot be overridden?
or is there a comma needed between the path and the file name. I haven't tried that.
 
users\default contains the default user profile template that new profiles inherits from, you shouldn't have any access there unless you run as elevated administrator.
You can use My.Computer.FileSystem.SpecialDirectories.Desktop to get desktop path for current user.
 
Back
Top