Boa tarde!!
Isso é possível, mas tanto quanto eu sei que envolvem o uso de API.
Leia:
http://www.dailydoseofexcel.com/archive ... -userform/
Tem um modelo em: http://www.jkp-ads.com/downloadscript.asp?filename=UserFormMenu.zip
Option Explicit
'Exemplo de código escrito por RobDog888 (vbforums.com)
'Macros deve estar habilitado para o código para executar
'Adicionar uma referência a biblioteca de objetos de escritório MS xx.0 (Se necessário, dependendo da app)
'Adicionar um controle de imagem e CommandButton para o UserForm.
Private moCBImage As Office.CommandBar
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
moCBImage.Delete
Unload Me
End Sub
Private Sub Image1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
'Invoke the menu on a right click on the Image control
If Button = xlSecondaryButton Then
moCBImage.ShowPopup
End If
End Sub
Private Sub UserForm_Initialize()
Dim oCBSavePic As Office.CommandBarButton
Dim oCBLoadPic As Office.CommandBarButton
Dim oCBClearPic As Office.CommandBarButton
'Add a titlebar caption
Me.Caption = "RobDog888 Context Menu Demo"
'Add the parent command bar popup
Set moCBImage = Application.CommandBars.Add("cbImage", msoBarPopup, , True)
With moCBImage
.Name = "cbImage"
.Enabled = True
End With
'Add the first child menu item to the popup
Set oCBSavePic = moCBImage.Controls.Add(msoControlButton, 1, "8889", , True)
With oCBSavePic
.Caption = "Save Picture"
.Enabled = True
.FaceId = 3 'Save bitmap resource image id
.OnAction = "SaveImage"
.Style = msoButtonIconAndCaption
.Visible = True
End With
'Add the second child menu item to the popup
Set oCBLoadPic = moCBImage.Controls.Add(msoControlButton, 1, "8890", , True)
With oCBLoadPic
.Caption = "Load Picture"
.Enabled = True
.FaceId = 23 'Open folder bitmap resource image
.OnAction = "LoadImage"
.Style = msoButtonIconAndCaption
.Visible = True
End With
'Add the third child menu item to the popup
Set oCBClearPic = moCBImage.Controls.Add(msoControlButton, 1, "8891", , True)
With oCBClearPic
.BeginGroup = True
.Caption = "Clear Picture"
.Enabled = True
.FaceId = 2087 'Delete bitmap resource image
.OnAction = "ClearImage"
.Style = msoButtonIconAndCaption
.Visible = True
End With
End Sub
'Behind Module1
Option Explicit
'This is where the event procedures for the menu item clicks need to be.
'Example code written by RobDog888 (vbforums.com)
'Macros must be enabled for the code to run
Public Sub SaveImage()
MsgBox "Save Picture", vbOKOnly + vbInformation, "RobDog888's Context Menu Demo"
End Sub
Public Sub LoadImage()
MsgBox "Load Picture", vbOKOnly + vbInformation, "RobDog888's Context Menu Demo"
End Sub
Public Sub ClearImage()
MsgBox "Clear Picture", vbOKOnly + vbInformation, "RobDog888's Context Menu Demo"
End Sub
'Behind ThisWorkbook (for Excel as an example)
Option Explicit
'Show UserForm at workbook opening.
'Example code written by RobDog888 (vbforums.com)
'Macros must be enabled for the code to run
Private Sub Workbook_Open()
UserForm1.Show vbModeless
End Sub
Att
Existem mil maneiras de preparar Neston. Invente a sua!
http://www.youtube.com/ExpressoExcel
Postado : 31/01/2013 8:31 am