shellを使用し、ワードパッドを起動します。
Access側はワードパッドが終了するまで待ちます。
■ Access実行画面
「ワードパッドを起動し終了まで待つ」のボタンをクリックします。
キャプションに「開始」~「起動」~「終了」と表示されます。
■ Access VBA 実行コード
Option Compare Database
Option Explicit
Private Declare Function OpenProcess Lib "kernel32" _
(ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Private Declare Function WaitForSingleObject Lib "kernel32" _
(ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Private Const SYNCRONIZE As Long = &H100000
Private Const INFINITE As Long = &HFFFF
Private Sub コマンド0_Click()
Dim IdProc As Long
Dim hProc As Long
Dim lret As Long
Me.Caption = "開始"
'ワードパッドを起動
IdProc = Shell("C:\Program Files\Windows NT\Accessories\wordpad.exe", vbNormalFocus)
Me.Caption = "起動"
hProc = OpenProcess(SYNCRONIZE, 1, IdProc)
lret = WaitForSingleObject(hProc, INFINITE)
lret = CloseHandle(hProc)
Me.Caption = "終了"
End Sub