R
redryderridesagain
I am trying to add a button to the menu bar after opening an email
with varying results. I use the code;
Private Sub oOpenMail_Open(Cancel As Boolean)
'Event gets triggered if oOpenMail is opened!
Dim oMailBar As Office.CommandBar
'Set a reference to commandbar Standard and add the commandbutton
Set oMailBar = oMailInspector.CommandBars("Menu Bar")
'Clean up left over buttons if any
Call DeleteButtons(oMailBar)
'set oMailTagsButton
Set oMSubjectButton =
oMailBar.Controls.Add(Type:=msoControlButton)
oMailBar.Visible = True
'Set properties of "Msubject" button
With oMSubjectButton
.Caption = "MSubject"
On Error Resume Next
.Picture = LoadPicture(root & "spidey.bmp")
On Error GoTo 0
.Style = msoButtonIconAndCaption
End With
'Clean up
Set oMailBar = Nothing
End Sub
Email is either in rich text or html format there are either 8 or 9
items on the menu bar before I add my button. The icon is sometimes
displayed with caption and sometimes the caption by itself. The module
behind the button is sometimes triggered and aassumes foreground and
sometimes triggered and remains behind other windows. Sometimes no
action is triggered or at least the form which is the action does not
show up. Why so many behaviors for a message? All suggestions/comments
welcomed. Thanks
with varying results. I use the code;
Private Sub oOpenMail_Open(Cancel As Boolean)
'Event gets triggered if oOpenMail is opened!
Dim oMailBar As Office.CommandBar
'Set a reference to commandbar Standard and add the commandbutton
Set oMailBar = oMailInspector.CommandBars("Menu Bar")
'Clean up left over buttons if any
Call DeleteButtons(oMailBar)
'set oMailTagsButton
Set oMSubjectButton =
oMailBar.Controls.Add(Type:=msoControlButton)
oMailBar.Visible = True
'Set properties of "Msubject" button
With oMSubjectButton
.Caption = "MSubject"
On Error Resume Next
.Picture = LoadPicture(root & "spidey.bmp")
On Error GoTo 0
.Style = msoButtonIconAndCaption
End With
'Clean up
Set oMailBar = Nothing
End Sub
Email is either in rich text or html format there are either 8 or 9
items on the menu bar before I add my button. The icon is sometimes
displayed with caption and sometimes the caption by itself. The module
behind the button is sometimes triggered and aassumes foreground and
sometimes triggered and remains behind other windows. Sometimes no
action is triggered or at least the form which is the action does not
show up. Why so many behaviors for a message? All suggestions/comments
welcomed. Thanks