JeffGrant
Well-known Member
- Joined
- Apr 7, 2021
- Messages
- 558
- Office Version
- 365
- Platform
- Windows
Hi All,
I require an external batch file to complete before continuing with the VBA code. Dr Google tells me plenty of different methods to achieve it. I have not had any success with any of them suggestions.I particular followed a post on this message board by Jake975, with this (modified) code
VBA Code:
Sub DailyUpdate()
Dim strCommand As String, wsh As Object
Set wsh = CreateObject("Wscript.Shell")
'using Wscript
strCommand = Chr(34) & "C:\Users\jeff\OneDrive\Desktop\New Horses\PuntingForm_v18.exe" & Chr(34)
wsh.Run strCommand, 0, True
Sheet2.Range("AP11").Value = "Yes"
End Sub
The aim is to have a userform label update with a different colour after the external file has completed, so that I can see that, that particular routine completed correctly.
The change in colour works great. However, the WaitOnReturn parameter in this line:
wsh.Run strCommand, 0, True
is being ignored because I can that the value in Sheet2.Range("AP11").Value = "Yes" is being updated before the external file has even started.
Any ideas are greatly appreciated.