Assunto: Realce de botões Seg Abr 16, 2012 9:24 pm
Mais uma vez solicitado a ajuda... Desta vez gostaria de saber, se possível, como se faz para que ao passar o mouse sobre um botão de ação de uma Macro, e também quando clicar neste, o botão seja realçado. O propósito é mostrar que aquele botão está sendo acionado.
alexandrevba
Mensagens : 1820 Data de inscrição : 13/07/2011 Localização : Serra - ES
Assunto: Re: Realce de botões Ter Abr 17, 2012 3:20 am
Boa noite!!
Exemplo parecido ...
Código:
Private Sub CommandButton1_Enter() Call ChangeBtnColor End Sub
Private Sub CommandButton1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Call ChangeBtnColor End Sub
Private Sub CommandButton2_Enter() Call ChangeBtnColor End Sub
Private Sub CommandButton2_Exit(ByVal Cancel As MSForms.ReturnBoolean) Call ChangeBtnColor End Sub
Private Sub CommandButton3_Enter() Call ChangeBtnColor End Sub
Private Sub CommandButton3_Exit(ByVal Cancel As MSForms.ReturnBoolean) Call ChangeBtnColor End Sub
Private Sub ChangeBtnColor() 'Exit Sub Dim obj As Object
Set obj = UserForm1.ActiveControl
If obj.Name Like "Comm*" Then 'Is it a commandbutton If obj.BackColor = &HFF& Then 'Is it Red obj.BackColor = &H8000000F 'Change to default color Else obj.BackColor = &HFF& 'Change to Red End If End If Set obj = Nothing End Sub
Mitterrand
Mensagens : 36 Data de inscrição : 03/02/2012
Assunto: Re: Realce de botões Qua Abr 25, 2012 5:15 am
Não consegui fazer! Teria uma maneira mais fácil de compreender? Imagine que tem uma botão que copia o conteúdo de uma célula e leva para outra. Gostaria que esse botão ficasse em cor e/ou relevo diferente ao ser acionado.
alexandrevba escreveu:
Boa noite!!
Exemplo parecido ...
Código:
Private Sub CommandButton1_Enter() Call ChangeBtnColor End Sub
Private Sub CommandButton1_Exit(ByVal Cancel As MSForms.ReturnBoolean) Call ChangeBtnColor End Sub
Private Sub CommandButton2_Enter() Call ChangeBtnColor End Sub
Private Sub CommandButton2_Exit(ByVal Cancel As MSForms.ReturnBoolean) Call ChangeBtnColor End Sub
Private Sub CommandButton3_Enter() Call ChangeBtnColor End Sub
Private Sub CommandButton3_Exit(ByVal Cancel As MSForms.ReturnBoolean) Call ChangeBtnColor End Sub
Private Sub ChangeBtnColor() 'Exit Sub Dim obj As Object
Set obj = UserForm1.ActiveControl
If obj.Name Like "Comm*" Then 'Is it a commandbutton If obj.BackColor = &HFF& Then 'Is it Red obj.BackColor = &H8000000F 'Change to default color Else obj.BackColor = &HFF& 'Change to Red End If End If Set obj = Nothing End Sub
alexandrevba
Mensagens : 1820 Data de inscrição : 13/07/2011 Localização : Serra - ES
Assunto: Re: Realce de botões Sex Abr 27, 2012 2:39 pm
Bom dia!! Tente adaptar...
Código:
Private Sub CommandButton1_Enter() Call ChangeBtnColor
Seu_Código_de_Copiar_e_Colar
End Sub
Private Sub ChangeBtnColor() 'Exit Sub Dim obj As Object
Set obj = UserForm1.ActiveControl
If obj.Name Like "Comm*" Then 'Is it a commandbutton If obj.BackColor = &HFF& Then 'Is it Red obj.BackColor = &H8000000F 'Change to default color Else obj.BackColor = &HFF& 'Change to Red End If End If Set obj = Nothing End Sub