Hello,Could you do it via a Macro?
Alternatively set a flag somewhere and clear it when batch job is complete, and check to see if it has been cleared from the calling process.?
Macro might be a cleaner option.?
What does that mean? A batch of what? Literal batch .bat files? Scripts? Queries? Provide some details. There are a number of options available, but I don't know enough about your process to offer much.I have a batch Job run via Access
Yeah Literally Batch Job file, ".bat" to running once button clickedWhat does that mean? A batch of what? Literal batch .bat files? Scripts? Queries? Provide some details. There are a number of options available, but I don't know enough about your process to offer much.
Well Macroes only run functions, but I was thinking of you running a particular function.Hello,
if i will be using Macro, what specific action do i need to use, i just check on the list and cannot see any applicable to running batchjob.
Thanks
Option Explicit
Sub Example()
Dim WMI As Object
Set WMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
Shell "C:\Users\Tom\Desktop\test1.bat"
WaitUntilNotRunning WMI, "test1.bat"
Shell "C:\Users\Tom\Desktop\test2.bat"
WaitUntilNotRunning WMI, "test2.bat"
MsgBox "All Done"
End Sub
Sub WaitUntilNotRunning(WMI, CmdLineSearch)
Do
DoEvents
Loop Until Not ItsRunning(WMI, CmdLineSearch)
End Sub
Function ItsRunning(WMI, CmdLineSearch) As Boolean
Dim Processes, Process
Set Processes = WMI.ExecQuery("select * from win32_process")
For Each Process In Processes
If InStr(Process.CommandLine, CmdLineSearch) Then
ItsRunning = True
Exit Function
End If
Next
End Function