MS Access 2007 / Win 7
I need to pause a macro until an external command processes. I'm assuming teh macro will then continue when the command finishes. I found the below function on the microsoft site. I get error: Run-time error 53 File Not Found: Kernel and when I opt to debug this line is highlighted: While (GetModuleUsage(hMod)). I know nothing about VB. I googled on that error and not finding anything that helps.
I'm calling the function as RunCode: WaitShell("C:\SSCC Label App\FSSCC.exe")
How do I get this running? Or, if necessary, is there another function available that will stop a macro long enough for a command window to run then continue when it closes?
Option Explicit
Declare Function GetModuleUsage% Lib "Kernel" (ByVal hModule%)
Function WaitShell(AppName As String)
Dim hMod As Integer
hMod = Shell(AppName, 1)
If (Abs(hMod) > 32) Then
While (GetModuleUsage(hMod))
DoEvents
Wend
Else
MsgBox "Unable to start " & AppName
End If
End Function
thanks!