Excel vba export csv to onedrive works perfectly on my machine but not on clients who has share

tonymaclaren

New Member
Joined
Dec 16, 2018
Messages
3
I desperately hope someone can help.I have some simple VBA code that makes a copy of a worksheet and saves it to a shared folder on Business OneDrive, the main bit of code is just:

Sheets("Data").Select
Sheets("Data").Copy

ActiveWorkbook.SaveAs Filename:="https:// blah /bla".
, FileFormat:=6, CreateBackup:=False

It works perfectly.BUT when I share the folder for my client, it asks for credentials for the correct directory on OneDrive and then gives the error error "1004 method save as of object workbook failed". I should add the client can view the same shared directory and upload the same file manually with no problem whatsoever !

It is not a .csv problem as I originally thought because the same problem occurs with .xlsx in testing.
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Maybe

Code:
[LEFT][COLOR=#333333][FONT=Verdana]ActiveWorkbook.SaveAs Filename:="https:// blah /bla".[/FONT][/COLOR]
[COLOR=#333333][FONT=Verdana], FileFormat:=6, CreateBackup:=False, [/FONT][/COLOR][/LEFT][COLOR=#0000ff][LEFT][FONT=Verdana]accessmode:=xlShared[/FONT][/LEFT][/COLOR][LEFT][COLOR=#333333][FONT=Verdana][/FONT][/COLOR][/LEFT]
 
Upvote 0
Thank you Kamolga. That does not work at all. It compiles but throws the 1004 error even on my machine.
FileFormat:=6, CreateBackup:=False, _
accessmode:=xlShared

accessmode:=xlExclusive works on my machine burt not on the clients.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,106
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