PDA

View Full Version : Auto run Macro when i open an email



kar75
11-15-2012, 06:30 AM
Hi

i am a novice to VBA. i need help in developing a piece of code that run when an email is opened.

BrianMH
11-16-2012, 01:08 AM
Can you explain in detail what you want to do? Also do you mean when you open an email to send to someone or open an email from someone? Do you want it to activate whenever you open a new email or only specific emails. You really need to provide much more detail.

kar75
11-16-2012, 03:58 AM
Brain Thanks for responding..

i am planning to write a code that will display the BCC listing in an email sent or cc'd to me.

i need this code to run whenever i open any email in outlook (either in the inbox or a PST folder).

So a autorun macro that runs when i open an email......

skatonni
11-20-2012, 06:38 PM
In ThisOutlookSession


Dim WithEvents insp As Outlook.Inspectors

Private Sub Application_Startup()
Set insp = Application.Inspectors
End Sub

Private Sub insp_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Size > 0 And Inspector.CurrentItem.Class = olMail Then
MsgBox "Amazing trick here."
End If
End Sub