VB Automate New Mail

  • Thread starter Thread starter Carl Kollaritsch
  • Start date Start date
C

Carl Kollaritsch

Howdy!

Is there any way that I can Open Up a New Outlook Message
from VB 6.0 and populate the To:, Subject: and Text
fields - do all of this and display it in the Outlook
framework for a New Message?

I already know how to create and send MAPI MailItems.

We have a VB application that extracts data from our
databases and the users want to be able to pipe it into an
Outlook New Message framework and edit it from there prior
to sending it.

I have tried this with the Outlook View Control, but the
NewMessage and Reply Methods do not allow for parameters
that could help here.

I appreciate all of your input. Thanks!
 
Sub CreateNewMailItem()
Dim oMail As Outlook.MailItem
Dim oOL As Outlook.Application

On Error Resume Next

Set oOL = CreateObject("Outlook.Application")
oOL.GetNameSpace("MAPI").Logon
Set oMail = oOL.CreateItem(olMailItem)

oMail.Recipients.Add "(e-mail address removed)"
oMail.Recipients(1).Resolve
oMail.Subject = "This is the subject"
oMail.Body = "This is the text"
oMail.Display

Set oMail = Nothing
Set oOL = Nothing
End Sub
 
Ken,

Oh my gosh, I was 99% of the way there - all I needed was
the .Display! Thanks Billions!

Carl
 
Back
Top