|
本帖最后由 japhler 于 2023-5-19 13:24 编辑
Private 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) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function ClipCursor Lib "user32" (lpRect As Any) As Long
Private Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Long) As Long
Private Sub UserForm_Initialize()
Application.EnableCancelKey = xlDisabled
SetWindowPos hWndForm, -1, 0&, 0&, 0&, 0&, 3
Call SetForegroundWindow(hWndForm)
End Sub
Function hWndForm() As Long
hWndForm = FindWindow("ThunderDFrame", word辅窗.Caption)
End Function
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
SetWindowPos hWndForm, -2, 0&, 0&, 0&, 0&, 3
Application.EnableCancelKey = xlInterrupt
End Sub
这个会置顶到WORD和EXCEL,如何才能只置顶在WORD上?请高手赐教!
|
|