Issue Running macro on workbook in the cloud

mikecox39

Active Member
Joined
Mar 5, 2014
Messages
251
Office Version
  1. 365
Platform
  1. Windows
I use OneDrive, configured to combine my System's Documents folder and OneDrive's Document folder. I didn't realized it was set up this way, I guess it's the default setting, until I failed to find my System's Document folder on my C: drive and couldn't.

The problem is that OneDrive seems to cause is a Run-Time 52 error and Debug highlights the "If Not Dir... " line" line of the macro I'm trying to run on my workbook.
Code:
[COLOR=#333333][FONT=monospace]If Not Dir(ThisWorkbook.Path & "\" & NextName & ".xlsm") = vbNullString Then[/FONT][/COLOR][COLOR=#333333][FONT=monospace]MsgBox "Workbook " & NextName & " has been created."[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]'check that newly saved file is active[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]If ActiveWorkbook.Name = NextName & ".xlsm" Then[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]MsgBox "Will now clear " & NextName & " for use."[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]Else[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]MsgBox "The active workbook is not " & NextName & vbLf & _[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]"Will now terminate the macro."[/FONT][/COLOR]
[COLOR=#333333][FONT=monospace]Exit Sub[/FONT][/COLOR]

Because of the Dir reference It occurred to me that OneDrive might be causing the problem, so I moved the workbook to a folder on my HD and the error didn't occur again.

Has anyone else had problems running macros on files in the cloud?
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Yes plenty.

At work we have files in the cloud and on sharepoint and this can create a mess when using macro's that 'save as', or indeed opening files, etc. A real pain. But alas, VBA is just an afterthought for the Office developers these days. In a few years time I think the effective functionality of file actions using VBA will be zero.
 
Upvote 0
Yes plenty.

At work we have files in the cloud and on sharepoint and this can create a mess when using macro's that 'save as', or indeed opening files, etc. A real pain. But alas, VBA is just an afterthought for the Office developers these days. In a few years time I think the effective functionality of file actions using VBA will be zero.
Thanks for sharing that disappointing bit of information. Seems like this issue would be more front and center, with all the cloud storage being done today. I was surprised that no one seems aware of why I was having problems using OneDrive. But there was a point when I was being prompted for a OneDrive password, though I haven't been lately. I thought that meant that I just had to plug in a pw to make it work.
 
Upvote 0
What you could also experiment with is the path that leads to the cloud/sharepoint location. because there is a difference even within windows systems. Windows explorer gives me a different result than VBA workbook.path. At work I have even more problems because of the various restrictions IT have put on access to certain parts like the user folders.
 
Upvote 0
What you could also experiment with is the path that leads to the cloud/sharepoint location. because there is a difference even within windows systems. Windows explorer gives me a different result than VBA workbook.path. At work I have even more problems because of the various restrictions IT have put on access to certain parts like the user folders.
Thanks for that F/U, I will keep it in mind for future ref. At this point I am only dealing with one WB, from my home office and I am the only one editing it. I put it in the cloud for safe keeping but mostly use it on my HD. Now, when I run the update macro I do it from the file on my HD then copy the result to the cloud and keep a backup on my HD as well.

btw thanks for the "Short Guide..." link! I am studying VBA on line and I've found it very helpfu. I have bookmarked it for quick reference.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,054
Latest member
juliecooper255

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