Outllok Automation

Discussion in 'Microsoft Access Form Coding' started by Guest, Sep 1, 2007.

  1. Guest

    Guest Guest

    I created a function to attach file.
    The function attaches the file and displays the outlook for the user. He can
    add address or write something in the body text. When he finishes, click send
    button and the email is gone and outlook window is closed.
    Apparently it works well.

    However, yesterday I received a message showing, the memory is low.
    I open task manager and I saw many outlook instances open.

    I verify the outlook still running. I set objOutlookMsg = Nothing and
    Set objOutlook = Nothing

    Is it possible somebody tell me what is wrong in my function?
    Thanks a lot.
    jcp
    -----------------------
    Here you are the function to attach files.

    Function EmailAttachFile()
    Dim objOutlook As Outlook.Application
    Dim objOutlookMsg As Outlook.MailItem
    Dim AttachFile As String

    AttachFile = "C:\Test.doc"

    Set objOutlook = CreateObject("Outlook.Application") ' Create the
    Outlook session.
    Set objOutlookMsg = objOutlook.CreateItem(olMailItem) ' Create
    the message.

    With objOutlookMsg
    .To = "jose perdigao"
    .CC = ""
    .BCC = ""
    .Subject = "This is a test"
    .Body = "Tell me if it works"
    End With

    If Dir(AttachFile) <> "" Then objOutlookMsg.Attachments.add AttachFile

    objOutlookMsg.Display

    Set objOutlookMsg = Nothing
    Set objOutlook = Nothing

    End Function

    --
    Jose
     
    Guest, Sep 1, 2007
    #1
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kelly

    Re: Office Automation with Excel

    Kelly, Jul 2, 2003, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    447
    Kelly
    Jul 2, 2003
  2. Tammy

    Automation/Return

    Tammy, Jul 22, 2003, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    154
    Tammy
    Jul 22, 2003
  3. EricB

    creating a hyperlink using outlook automation

    EricB, Jul 24, 2003, in forum: Microsoft Access Form Coding
    Replies:
    3
    Views:
    238
    EricB
    Jul 28, 2003
  4. Guest

    Send email from acceess with outllok templates

    Guest, Jul 22, 2004, in forum: Microsoft Access Form Coding
    Replies:
    1
    Views:
    176
    Michael Curry
    Jul 22, 2004
  5. Johnny

    Send from Access to Outllok help

    Johnny, May 4, 2009, in forum: Microsoft Access Form Coding
    Replies:
    0
    Views:
    143
    Johnny
    May 4, 2009
Loading...

Share This Page