CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: E-mail pop-up

  1. #1
    Join Date
    Feb 2001
    Posts
    12

    E-mail pop-up

    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


  2. #2
    Join Date
    Apr 2000
    Posts
    737

    Re: E-mail pop-up

    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.




  3. #3
    Join Date
    Mar 2001
    Location
    Australia
    Posts
    146

    Re: E-mail pop-up

    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



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured