• Subject: How to set the Email address in the To field with MailOpen Event
  • Author: Jan T.
  • Date: 09 Jul 2010
  • References:
I use Office 2000 and try to set an email address on the Open Event
of a new mail. This is my code in ThisOutlookSession:

Dim WithEvents colInsp As Outlook.Inspectors
Dim WithEvents oMail As Outlook.MailItem

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

Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
If Inspector.CurrentItem.Class = olMail Then
Set oMail = Inspector.CurrentItem
End If
End Sub

Private Sub oMail_Open(Cancel As Boolean)
oMail.To = "Jan.T@gmail.com"
oMail.Subject = "Test"
oMail.Body = "This is a test..."
End Sub

PROBLEM: I can set the Subject and the Body to any text, but I cannot
add an email address to the To field? Why? Is it possible?

What do I need to do to set the email address in the To field?


Regards
Jan
09 Jul 2010How to set the Email address in the To field with MailOpen Event.Jan T.
Contact Us
All times are in (US) Eastern Daylight Time (GMT -4:00)