Cannot save to desktop

bikeordie1

New Member
Joined
Jun 28, 2012
Messages
46
at the end of my code is:
activeworkbook.saveas "C:\users\" & environ("Username") & "\Desktop\GRN Report - " & format(date, "MM-DD-YYYY")

Now this works fine for myself and a few other users in the office (all the same platforms - win7)

except for 2 users which get this error:

run time error '1004':
Microsoft excel cannot access the file:
'C:\Users\john.doe\Desktop\0AB3D100'. There are several possible reasons:
the file name or path does not exsit
the file is in use
workbook you are trying to save has the same name

the part in red is different every time the error comes up. like a temp file or something. I cannot for the life of me find the issue here. Any thoughts?
 
Try putting the location full path into a string first (so there are no amperstand or quote characters), then use that string as your final path such as:
Code:
activeworkbook.saveas TheStringPath
 
Last edited:
Upvote 0
It's also good to include the file extension (.xls, .xlsm, .xlsx). I've run into problems with that before.
 
Upvote 0
Tried making the path and then referencing that. no go. also with the extension included.

When i pre-assemble the path it all looks correct if i hover over it during pause when the error happens. it looks perfect. yet that random number shows up in the error box right over top of it
 
Upvote 0
If your launching macro key combo has a "Shift" in it, that can play havoc with workbook routines which can randomly result in a run time error 1004 (due to a bug in MS). Such as if you start macro with "Ctrl-Shft-R" change it to Ctrl-R instead and see if that does it.
 
Last edited:
Upvote 0
Is the macro routine that calls "Workbook_Open" launched from a key combo using "Shift" ? As it is especially Workbook_Open that runtime error 1004 has trouble with. It can happen randomly much later in a program usually involving opening a workbook if the macro uses Shift key to start the macro.
 
Upvote 0
You can test this by starting the macro from your menu in macros view then run from there. If everything works from there, then the "Shift" key is the problem.
 
Upvote 0
no shift keys involved. if i run the macro from the menu, or let it initiate from the workbook_open calling it then it has the same result.

Frustrating...
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top