'定义GetForegroundWindows API 获取最前面窗体
Declare Function GetForegroundWindow Lib "user32" () As Long
Declare Function SetWindowPos& Lib "user32" _
(ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, _
ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Const HWND_BOTTOM = 1, SWP_NOSIZE = &H1, SWP_NOMOVE = &H2
Sub jspjb()
Application.Dialogs(9).Show '打开对话框
Application.Wait Now + TimeValue("00:00:02")
hwnds = GetForegroundWindow()
SetWindowPos hwnds, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE Or SWP_NOMOVE
'执行其它代码!