|
楼主 |
发表于 2023-5-19 13:21
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
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程序,不知道怎么改动 |
|