Hì, cho mình mạn phép trích 1 đoạn code sưu tầm được:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const WS_SYSMENU As Long = &H80000
Private Const GWL_STYLE As Long = -16&
Private Sub HideCloseBox(ByVal UserForm As UserForm)
Dim hwnd As Long
Dim WindowStyle As Long
If Application.Version < 9 Then
hwnd = FindWindow("ThunderXFrame", UserForm.Caption)
Else
hwnd = FindWindow("ThunderDFrame", UserForm.Caption)
End If
If hwnd <> 0 Then
WindowStyle = GetWindowLong(hwnd, GWL_STYLE)
SetWindowLong hwnd, GWL_STYLE, WindowStyle And Not WS_SYSMENU
End If
End Sub
Private Sub UserForm_Initialize()
HideCloseBox Me
End Sub
Mời bạn sử dụng