VBA macro works on one computer but when other use it, it attempts to save to the wrong save path and runtime errors

ZMathis

New Member
Joined
Dec 15, 2021
Messages
7
Office Version
  1. 2016
Platform
  1. Windows
Hello,

I have a Macro that un-shares the workbook then re-shares it after the macro has run. It works for me and when re-sharing it, it saves to the correct file path given in the vba. But when others in the office try it, it adds 7 or 8 random numbers at the end of the save address, then Runtime Error 1004s. I was thinking it might have something to do with the enabling content because someone suggested having them manually save after enabling content to unflag themselves as non-enabled in the system, but, while it did run the macro up to the last line (the re-sharing part) where it hadn't been doing before (before it would give the same error but all the macro accomplished before erroring out was un-sharing it), it still is giving that runtime error. When I hit the debug, it highlights the line below, with the correct save file path.

ActiveWorkbook.SaveAs "x:\example\filename.xlsm", , , , , , xlShared

But the Runtime Error 1004 is stating that the file path doesn't exist "x:\example\filename\0342242", the numbers are different every time.

Thank you in advance for any guidance.
 
Just curious, are you actually wanting to save it to a different name to what it was originally ?
If not would what is in this post work (modified for my post #9)
Share/Unshare Workbook
ie
VBA Code:
ThisWorkbook.SaveAs ThisWorkbook.FullName, AccessMode:=xlShared
 
Upvote 0
Solution

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
I think that actually worked! Thanks so much for the insight, I remember reading that post before when I was originally researching before writing the code. I guess it was something along the lines of how Excel was interacting with the networking path for the different users.
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,161
Members
453,021
Latest member
Justyna P

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