Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Macro auto run

Status
Not open for further replies.

Lilivr112

Technical User
Oct 11, 2012
1
US
I have a script that works only if i manually run it from the macro tools option. How can i make it run automatically when outlook is started.

Public WithEvents myOlApp As Outlook.Application

Public Sub Initialize_handler()

Set myOlApp = CreateObject("Outlook.Application")
End Sub

Private Sub myOlApp_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim prompt As String
If InStr(1, Item.Subject, "For Official Use Only - Privacy Sensitive", vbTextCompare) = False Then
Item.Subject = Item.Subject & " For Official Use Only - Privacy Sensitive"
End If

End Sub
 
Not sure about Outlook, but in Access all you do is name the Macro "autoexec".

Beir bua agus beannacht!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top