Button to forward email to another address

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to setup a tollbar button so a user can click it to forward
email that he feels is spam to anothe email address?

Thanks
 
Would like to have the email address pre set and not have to enter it each time
 
Hi,

here is a sample for adding your own CommandBar with one -Button. To get
the button click event you need to declare a variable WithEvents

Private WihEvents YourButton as Office.CommandBarButton

Private Application_Startup()
Set YourButton=CreateCommandBarButton(Application.ActiveExplorer _
.CommandBars)
End Sub

Private Sub YourButton_Click(ByVal Ctrl As Office.CommandBarButton,
CancelDefault As Boolean)
' here your code goes
End Sub

Private Function CreateCommandBarButton(oBars As Office.CommandBars) As
Office.CommandBarButton
On Error Resume Next
Dim oMenu As Office.CommandBar
Dim oBtn As Office.CommandBarButton
Const BAR_NAME As String = "YourCommandBarName"
Const CMD_NAME As String = "YourButtonName"

Set oMenu = oBars(BAR_NAME)
If oMenu Is Nothing Then
Set oMenu = oBars.Add(BAR_NAME, msoBarTop, , True)
Set oBtn = oMenu.Controls.Add(msoControlButton, , CMD_NAME, , True)
oBtn.Caption = CMD_NAME
oBtn.Tag = CMD_NAME

Else
Set oBtn = oMenu.FindControl(, , CMD_NAME)
If oBtn Is Nothing Then
Set oBtn = oMenu.Controls.Add(msoControlButton, , CMD_NAME, ,
True)
End If
End If

oMenu.Visible = True
Set CreateCommandBarButton = oBtn
End Function
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top