Boa tarde!!
Faça os testes.
Favor alterar a propriedade
ShowModal para
False.
Código: Selecionar todos
'Windows API calls
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 Declare Function ShowWindow Lib "user32" ( _
ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long
Private Declare Function EnableWindow Lib "user32" ( _
ByVal hWnd As Long, _
ByVal fEnable As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" ( _
ByVal hWnd As Long) As Long
Private Declare Function SetFocus Lib "user32" ( _
ByVal hWnd As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
ByVal hWnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Integer, _
ByVal lParam As Long) As Long
Private Declare Function LockWindowUpdate Lib "user32" ( _
ByVal hWndLock As Long) As Long
'Window styles
Private Const GWL_STYLE As Long = (-16) 'The offset of a window's style
Private Const GWL_EXSTYLE As Long = (-20) 'The offset of a window's extended style
Private Const WS_CAPTION As Long = &HC00000 'Style to add a titlebar
Private Const WS_SYSMENU As Long = &H80000 'Style to add a system menu
Private Const WS_MINIMIZEBOX As Long = &H20000 'Style to add a Minimize box on the title bar
Private Const WS_MAXIMIZEBOX As Long = &H10000 'Style to add a Maximize box to the title bar
Private Const WS_EX_APPWINDOW As Long = &H40000 'Application Window: shown on taskbar
Private Const WS_EX_TOOLWINDOW As Long = &H80 'Tool Window: small titlebar
'Hide or show a window
Private Const SW_HIDE As Long = 0
Private Const SW_SHOW As Long = 5
'Windows messages
Private Const WM_SETICON = &H80
Private hWnd As Long
Private Sub Userform_Initialize()
Dim lStyle As Long
'Get the userform's window handle
If Val(Application.Version) < 9 Then
hWnd = FindWindow("ThunderXFrame", Me.Caption) 'XL97
Else
hWnd = FindWindow("ThunderDFrame", Me.Caption) 'XL2000+
End If
SendMessage hWnd, WM_SETICON, True, 0
SendMessage hWnd, WM_SETICON, False, 0
LockWindowUpdate hWnd
EnableWindow FindWindow("XLMAIN", Application.Caption), True
ShowWindow hWnd, SW_HIDE 'Hide the form
lStyle = GetWindowLong(hWnd, GWL_STYLE) Or WS_CAPTION Or WS_SYSMENU Or WS_MINIMIZEBOX Or WS_MAXIMIZEBOX
SetWindowLong hWnd, GWL_STYLE, lStyle
lStyle = GetWindowLong(hWnd, GWL_EXSTYLE) Or WS_EX_APPWINDOW And Not WS_EX_TOOLWINDOW
SetWindowLong hWnd, GWL_EXSTYLE, lStyle
DrawMenuBar hWnd
SetFocus hWnd
ShowWindow hWnd, SW_SHOW 'Reshow the userform
LockWindowUpdate 0& 'Unfreeze the form
'Set the Excel window's enablement to the correct choice
EnableWindow FindWindow("XLMAIN", Application.Caption), 1
End Sub
Obs: Testado no office
32Bits, não contem a rotina para criar
Icone
Att
Espero ter Ajudado.
Se a mensagem foi util Favor
Clicar na mãozinha.
Quando necessário, lembre se de marcar o tópico como
[RESOLVIDO].
Tenha um bom dia
