snuffnchess
Board Regular
- Joined
- May 15, 2015
- Messages
- 71
- Office Version
- 365
- Platform
- Windows
I have been running the below code in projects on my computer and various others with no issue... but I have a coworker that is getting a Run-Time Error '-2147024894 (80070002)' / Method 'Run' of object 'IWshShell3' Failed message when I try to run the macro on their system
I have tried using the direct path to the onedrive.exe file as well, and that did not alter the error message. Is there something else that i should be trying?
(code was originally copied and used over and over and over again on my PC and others without issue from VBA start stop Onedrive Sync client)
VBA Code:
Private Sub ManageOnedriveSync(ByVal action As Integer)
Dim shell As Object
Set shell = VBA.CreateObject("WScript.Shell")
Dim waitTillComplete As Boolean: waitTillComplete = False
Dim style As Integer: style = 1
Dim errorcode As Integer
Dim path As String
Dim commandAction As String
Select Case action
Case 1
commandAction = "/shutdown"
End Select
path = Chr(34) & "%programfiles%\Microsoft OneDrive\Onedrive.exe" & Chr(34) & " " & commandAction
errorcode = shell.Run(path, style, waitTillComplete)
End Sub
Sub Test()
ManageOnedriveSync 1
End Sub
I have tried using the direct path to the onedrive.exe file as well, and that did not alter the error message. Is there something else that i should be trying?
(code was originally copied and used over and over and over again on my PC and others without issue from VBA start stop Onedrive Sync client)