PDA

View Full Version : Mail from Excel via Outlook



clvestin
01-21-2007, 09:05 AM
In my continuing quest , I have found that code such as
With objmailitem
.To = "joe blow (blow@nngco.com;tom)"
.Subject = "subject"
.Attachments.Add "c:\filename.xls"
.Send
End With


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
Application.ActivateMicrosoftApp xlMicrosoftMail

objOLapp.Session.SyncObjects.Item(1).Start

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.

Bob Phillips
01-21-2007, 10:05 AM
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.

Zack Barresse
01-21-2007, 10:09 AM
Is this an Outlook issue or Excel?

clvestin
01-21-2007, 11:45 AM
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!

Zack Barresse
01-21-2007, 12:07 PM
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.