pId = Shell(strCmdLine, vbHide) ' Shell 传回 Process Id
pHnd = OpenProcess(SYNCHRONIZE, 0, pId) ' 取得 Process Handle
If pHnd <> 0 Then
Call WaitForSingleObject(pHnd, INFINITE) ' 无限等待,直到程序结束
Call CloseHandle(pHnd)
End If
Function 压缩文件(RARname As String, filname As String)
'功能:压缩文件
'参数:RARname---压缩文件名(含路径),filname---被压缩的文件名或文件夹名(含路径)
'示例:压缩文件 CurrentProject.Path & "\备份\后台备份.rar",CurrentProject.Path & "\备份\*.mdb"
Call Shell("C:\Program Files\WinRAR\WinRAR.exe a -ep -df """ & RARname & """ """ & filname & """", vbNormalFocus)
End Function