Macro Not Working For All Users

snehpetselyk

New Member
Joined
Jun 15, 2015
Messages
8
I've created a macro that runs from a commandbutton click. The macro opens 3 other files off a network drive, does a save-as (new filename is based on text in a cell), clears some fields, saves and closes all workbooks.

I can run the macro with no problems under my user login, on any machine. All other users get an error after all files are opened, while it is trying to do the save-as. Stepping through the macro, nothing after that point will work for them (clearing fields etc.), on any machine except mine (the machine the code was written on).

What could be causing this?

thanks,
Kyle
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Welcome to the Board!

What exactly does the error message say?
Are you are all on the same version of Excel?
Do you have the same references selected in VB?
 
Upvote 0
When the files are opened, does manual manipulations working: Delete, Cut .... just to be sure that access is enable
 
Upvote 0
Welcome to the Board!
What exactly does the error message say?
Are you are all on the same version of Excel?
Do you have the same references selected in VB?

Error code is;
"Run-time error '9'
Subscript out of range"

We are all using office 2013 or 365 whatever its called.

I'm not exactly sure what this means. The referenced sheets that are unable to be save-as are the ones the macro just opened.
 
Upvote 0
When the files are opened, does manual manipulations working: Delete, Cut .... just to be sure that access is enable

Yes, the users can delete, update, etc. manually, and even save or save-as manually. Just not with the code.
 
Upvote 0
On a version that works:
- Go to the VB Editor
- Click on the Tools menu, then select References
- Note all the references/libraries that are selected

On a version that doesn't work:
- do the same steps as above, compare the two, and note any references/libraries that are not selected

Regarding your error, does it give you a "Debug" option?
If so, when you click it, what line of code does it highlight?

It probably would be beneficial if you could post the code here, too.
 
Upvote 0
On a version that works:
- Go to the VB Editor
- Click on the Tools menu, then select References
- Note all the references/libraries that are selected

On a version that doesn't work:
- do the same steps as above, compare the two, and note any references/libraries that are not selected

Regarding your error, does it give you a "Debug" option?
If so, when you click it, what line of code does it highlight?

It probably would be beneficial if you could post the code here, too.

Thanks for the info on references. All references are the same.

The error does give a debug option, and the code it references is a save-as statement.

Code:
Workbooks(LrDate & "_data").SaveAs ("\\fullpathname_" & NrYear & "\Working_Folder\" & NrDate & "_data.xlsm")
 
Upvote 0
Are you sure that the users have the file path that you are building accessible to them on their computer?
 
Upvote 0
Are you sure that the users have the file path that you are building accessible to them on their computer?
Yes, the users have access to the file path. They can run the code just fine from my machine with their user login, but no other machine will work for them. I can run the code from any machine with my login. Doesn't make sense to me.
 
Upvote 0
Note that file/drive mappings are not only user specific, but can also be computer specific.
 
Upvote 0

Forum statistics

Threads
1,203,655
Messages
6,056,571
Members
444,877
Latest member
kat517

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