![]() |
|
#1
|
|||
|
|||
|
Is there any way to automatically run a macro every time I open the new mail message form ?
Please note that I mean the new mail message form that I open when I want to start a new outgoing message, not opening a newly received message. Thanks. |
|
#2
|
|||
|
|||
|
http://msdn.microsoft.com/en-us/libr...ffice.12).aspx
Place this in the ThisOutlookSession module. Untested Code:
Public WithEvents myOlInspectors As Outlook.Inspectors
Private Sub Application_Startup()
Set myOlInspectors = Application.Inspectors
End Sub
Private Sub myOlInspectors_NewInspector(ByVal Inspector As outlook.Inspector)
Dim msg as Mailitem
If (Inspector.CurrentItem.Class = olMail) Then
Set msg = Inspector.CurrentItem
If msg.Size = 0 Then
MsgBox "Replace the message box with your code."
End If
End If
Set msg = Nothing
End Sub
Last edited by niton; 02-24-2013 at 11:32 AM. Reason: Typo in "ThisOutlookSession" |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Weird message “the file ( ) should be opened as read-only unless changes to it need t | Jamal NUMAN | Word | 6 | 11-13-2013 01:53 AM |
Mail Merge error message
|
rec | Mail Merge | 1 | 04-29-2011 10:30 PM |
| Editing default message form | lvr123 | Outlook | 0 | 01-07-2011 05:33 AM |
| Do I need a Form or a Macro?? | Keith24249 | Excel | 0 | 08-23-2010 06:23 AM |
| sent mail error message | Carolemc | Outlook | 0 | 09-26-2006 03:21 AM |