Detalhes de vba usf formulario desabilitando botao fechar

PropriedadeValor
Nome:vba usf formulario desabilitando botao fechar
Descricao:

Saberexcel - o site das macros

Esses procedimentos e declarações do Aplicativo Microsoft Excel VBA, retiram o (X) de fechar o userform, você poderá usar isso para forçar o usuário a sair por um botão que o conduzirá a um outro lugar ou uma mensagem., baixe o exemplo, link no final da página.

INSIRA AS DECLARAÇÕES ABAIXO EM UM MÓDULO COMUM

Public Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Public Declare Function GetWindowLong Lib "user32" _
Alias "GetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long) As Long
Public Declare Function SetWindowLong Lib "user32" _
Alias "SetWindowLongA" (ByVal hWnd As Long, _
ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Public Const GWL_STYLE = -16
Public Const WS_SYSMENU = &H80000

Sub ChamarForm()
UserForm1.Show
End Sub

INSIRA OS PROCEDIMENTOS ABAIXO NA FOLHA DE CÓDIGO DO OBJETO USERFORM

Private Sub Label2_Click()
On Error Resume Next
ActiveWorkbook.FollowHyperlink "http://www.saberexcel.com.com/"
End Sub

Private Sub Label3_Click()
Link = "mailto:[email protected]"
On Error GoTo SbError
ActiveWorkbook.FollowHyperlink Address:=Link, NewWindow:=True '
Exit Sub

bError:
MsgBox "mensagem....... " & Link

End Sub

Private Sub UserForm_Initialize()

Dim hWnd As E_MarLong, lStyle As Long
If Val(Application.Version) >= 9 Then
hWnd = FindWindow("ThunderDFrame", Me.Caption)
Else
hWnd = FindWindow("ThunderXFrame", Me.Caption)
End If
lStyle = GetWindowLong(hWnd, GWL_STYLE)
SetWindowLong hWnd, GWL_STYLE, (lStyle And Not WS_SYSMENU)


End Sub


Aplicativo Microsoft Excel VBA - Saberexel - o site das macros



Nome do arquivo:vba usf formulario desabilitando botao fechar.zip
Tamanho: Vazio
Tipo:zip (Tipo de Mime: application/zip)
Autor:SaberExcel
Criado em: 29/11/2010 19:29
Visitas:Todos
Responsavel:Editor
Acessos:1232 Acessos
Atualizado em: 29/11/2010 19:30
Site: