Click to See Complete Forum and Search --> : E-mail pop-up
tomwalsh
April 1st, 2001, 04:35 PM
In VB(A), I am looking to have an Outlook e-mail window (with to:, from:, subject:, and message body filled out) to pop up on an event in my program. How do I do this from within VBA (MS Access)?
Thanks for any and all help!
-Tom
cksiow
April 1st, 2001, 07:55 PM
I actually program a email notify program which will notify you in the event of new mail. It works on POP3 server. It use a library from
http://vblib.virtualave.net
if you need the program, please send me a private message to give an email address for me to send to.
GungaDin
April 1st, 2001, 07:55 PM
The following should work in Access 97:
Dim olMail as Object
Dim olApp as Object
set olApp = CreateObject("Outlook.Application")
set olMail = olApp.CreateItem(0)
With olMail
.to = "Send to This Person"
.Subject = "This is the Subject"
.Body = "Hello" & vbCrLf & "This is my message"
.Display true
End With
olApp.Quit
Alternatively, if you include the Microsoft Outlook Object Model as a reference, the code would be as follows:
Dim olApp as new Outlook.Application
Dim olMail as Outlook.MailItem
set olMail = olApp.CreateItem(olMailItem)
With olMail
.to = "Send to This Person"
.Subject = "This is the Subject"
.Body = "Hello" & vbCrLf & "This is my message"
.Display true
End With
olApp.Quit
The True variable in the .Display line simply shows the mail item modally. If you omit this, then you will have to quit the olApp somewhere else as you can't quit the App without closing the e-mail.
Hope this helps,
Nathan Liebke
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.