mikecox39
Active Member
- Joined
- Mar 5, 2014
- Messages
- 251
- Office Version
- 365
- Platform
- 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.
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?
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?