Set Warnings Macro

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

Guest

I am trying to run a set warnings macro for everytime I send a message does
anyone have any Ideas how to set that up?

Donbenz
 
Put code in the Application_ItemSend event handler in the built-in ThisOutlookSession module.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Sample code:

Private Sub Application_ItemSend _
(ByVal Item As Object, Cancel As Boolean)
Dim strMsg As String
Dim res As Long
If Item.Subject = "" Then
Cancel = True
strMsg = "Please fill in the subject before sending."
MsgBox strMsg, _
vbExclamation + vbSystemModal, "Missing Subject"
Item.Display
End If
End Sub

For a more elaborate version that also checks for expected attachments, see http://www.outlookcode.com/codedetail.aspx?id=553

And for VBA basics, see http://www.outlookcode.com/d/vbabasics.htm


--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Sue,

When i try to load the code into my macro the saved macro disappears. Maybe
I am not setting it up right. I think it has some thing to do with the
Private Sub verses just the Regular Sub.

Thank You
 
Please provide exact steps that you followed.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Sue,

I begin by going to tools, then i go down to macros which opens up a tab and
then i click on macros. It then gives me the option to name a macro with
limited names. Then I click creat and it takes me to Microsoft Visual basic
and it looks like this.

Sub s()

End Sub

If i try to change the sub it disappears from my macros. Ive tried using
the DoCmd option it it just gives me an error saying something is wrong with
the Sub s ().

Donbenz
 
You need to create an event handler, not a macro. Press Alt+F11 to open the VBA environment, then put the code in the ThisOutlookSession module.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
Back
Top