Automating an Outlook button

ddantes
ddantes used Ask the Experts™
on
Running Outlook 2007 on a Windows 7 32-bit platform, I have a button on the toolbar which activates a VB script to add a suffix to recipients Email address.  The button's default condition is OFF, until it is pressed. and it resets to OFF when Outlook is first launched.  I wonder if there is a way to set the default condition to ON?
Here is the code.  Please be aware that I am not the author of this code and I'll need specific instructions if it is to be amended...

 
Sub ToggleAddSuffix()
    bolAddSuffix = Not bolAddSuffix
    MsgBox "AddSuffix is now " & IIf(bolAddSuffix, "ON", "OFF"), vbInformation + vbOKOnly, "Toggle Add Suffix"
End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
"Batchelor", Developer and EE Topic Advisor
Top Expert 2015
Commented:
In the VBA editor, you need to put this into ThisOutlookSession module:
Public Sub Application_Startup()
  bolAddSuffix = True
End Sub

Open in new window

Author

Commented:
Worked perfectly!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial