Consulting

Results 1 to 5 of 5

Thread: Mail from Excel via Outlook

  1. #1
    VBAX Regular
    Joined
    Jul 2005
    Posts
    74
    Location

    Mail from Excel via Outlook

    In my continuing quest , I have found that code such as
    [VBA]With objmailitem
    .To = "joe blow"
    .Subject = "subject"
    .Attachments.Add "c:\filename.xls"
    .Send
    End With
    [/VBA]

    won't really send my mail for me. It does however place the mail in Outlook's Outbox. (half the job, to my thinking)

    If further
    [VBA]Application.ActivateMicrosoftApp xlMicrosoftMail

    objOLapp.Session.SyncObjects.Item(1).Start[/VBA]

    Outlook opens, and the Send/Receive action takes place.
    Outlook remains open in my routine, but the mail has been sent.

    I'm not all that clear what I'm doing with the whole SyncObjects scenario, but perhaps someone can clear this issue up for me. Any advice would be appreciated.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    I guess that you don't have Outlook configured to immediately send, so it is awaiting the next send/receive cycle. Syncing it forces the send/receive, Item(1) is all account profiles.

  3. #3
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    Is this an Outlook issue or Excel?

  4. #4
    VBAX Regular
    Joined
    Jul 2005
    Posts
    74
    Location
    I have Outlook set for immediate Send/Receive (I believe "when connected" might be the relevent issue in my case).

    firefytr: re: your question I don't know!

  5. #5
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    So your data gets moved to the Outbox. What version of Outlook are you running? Do you see anything in the status bar regarding a Send/Receive? Does it send when you manually Send the data (F9)? The second portion of code you posted, is that part of your entire routine? That second part confuses me as to what it does or does not do for you. Of course I was under the impression that the SyncObjects collection was for "Sync"'ing a device.

Posting Permissions

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