lenrod
04-24-2012, 12:39 PM
I have been working on setting up a second send message button for outlook 2003. The user would click on new message in outlook and it would have a button next to the normal send button on the standard toolbar called send encrypted. the send encrypted button will add a string to the subject line which my email gateway will find and encrypt the message and send it on. I have the code written to send the message and the code written to create the button however I cannot get the vba created button to execute the vba to send the message. I am sure I am missing somethign silly I do appologize for my ignorace as this is my first try at this type of thing. thank you for any assistance.
Sub AddToolbarButton()
Dim objBar As Office.CommandBar
Dim objButton As Office.CommandBarButton
Set Item = Outlook.Application.ActiveInspector.CurrentItem
Set objBar = Outlook.Application.ActiveInspector.CommandBars("Standard")
Set objButton = objBar.Controls.Add(msoControlButton, , , before:=3)
With objButton
.Caption = "Send Encrypted"
.OnAction = "EncryptMail"
.TooltipText = "Send Encrypted Email"
.FaceID = 277
.Style = msoButtonIconAndCaption
.BeginGroup = True
End With
End Sub
Private Sub EncryptMail()
Set Item = Outlook.Application.ActiveInspector.CurrentItem
Item.Subject = "Encrypted Email Message: " & Item.Subject
Item.Send
End Sub
Sub AddToolbarButton()
Dim objBar As Office.CommandBar
Dim objButton As Office.CommandBarButton
Set Item = Outlook.Application.ActiveInspector.CurrentItem
Set objBar = Outlook.Application.ActiveInspector.CommandBars("Standard")
Set objButton = objBar.Controls.Add(msoControlButton, , , before:=3)
With objButton
.Caption = "Send Encrypted"
.OnAction = "EncryptMail"
.TooltipText = "Send Encrypted Email"
.FaceID = 277
.Style = msoButtonIconAndCaption
.BeginGroup = True
End With
End Sub
Private Sub EncryptMail()
Set Item = Outlook.Application.ActiveInspector.CurrentItem
Item.Subject = "Encrypted Email Message: " & Item.Subject
Item.Send
End Sub