+ Reply to Thread
Results 1 to 2 of 2

Controlling Outlook from Excel

  1. #1
    Registered User
    Join Date
    04-19-2007
    Posts
    50

    Controlling Outlook from Excel

    Hi Excel Experts,

    I'm a VBA/Access programmer. I'm new to using VBA with Excel. Does anyone know how to start the MS Outlook application from Excel? My code below sends the email automatically but I'd like for it to populate and then open Outlook before I send.

    My code:
    --------------------------------------------------------------------
    Set OLF = GetObject("", _
    "Outlook.Application").GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
    Set olMailItem = OLF.Items.Add ' creates a new e-mail message
    With olMailItem
    .Subject = "EXCEPTION REQUEST FOR TEMPORARY FACILITIES ACCESS (" & exceptapprvd & ")" ' message subject
    Set ToContact = .Recipients.Add("[email protected]") ' add a recipient
    Set ToContact = .Recipients.Add("[email protected]")
    Set ToContact = .Recipients.Add("" & mgruserid & "")
    ToContact.Type = olCC ' set latest recipient as CC
    .Body = theBody & Chr(13) & Chr(13) & "- Status: FTE" & Chr(13) & "- Name: " & emplFname & " " & emplMid & ". " & emplLname

    '.OriginatorDeliveryReportRequested = True ' delivery confirmation
    .ReadReceiptRequested = True ' read confirmation
    .Send ' sends the e-mail message (puts it in the Outbox)
    End With

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello TalyTech,

    You can add the recipients to this code. This waits until Outlook has been created before attempting to send the email. I have this to be more reliable method.

    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1