john316swan
Board Regular
- Joined
- Oct 13, 2016
- Messages
- 66
- Office Version
- 2019
- Platform
- Windows
I am looping through a connection to sync folders from a network drive onto a google drive and I can't figure out why cmd is giving me:
'robocopy' is not recognized as an internal or external command, operable program or batch file." error
Here is my code:
When I run the command line without the vba loop, it successfully copies those folders, but can't get the vba shell command to work properly. Thanks for your help!
@DanteAmor haha, since you usually are able to help, just tagging you up front
'robocopy' is not recognized as an internal or external command, operable program or batch file." error
Here is my code:
VBA Code:
'Here we can run the batch files to ROBOCOPY athletic offer letters to coaches
For Each item In ath
sourceCopy = """X:\Financial Aid – Athletics\2020-2021 Offer Letter & CW\" & item & """"
RoboCopy = """G:\My Drive\AthleticOfferLetter\" & item & "\2020-2021" & """"
shellCommand = "cmd /c robocopy " & sourceCopy & " " & RoboCopy & " /XO"
Call Shell(shellCommand, vbMaximizedFocus)
Next item
When I run the command line without the vba loop, it successfully copies those folders, but can't get the vba shell command to work properly. Thanks for your help!
@DanteAmor haha, since you usually are able to help, just tagging you up front

Last edited: