Choose which address to send from

J

jschping

Hi,

I want to use the DoCmd.SendObject in my VB code, but I have multiple
accounts set up in my Outlook. How do I choose which account it will send
from?

Thanks!
 
J

jschping

What is Automation and how do I use it?

Thanks!

Douglas J. Steele said:
Since SendObject is a generic interface, I don't believe it's capable of
that sophistication. You may have to use Automation.

See whether Tony Toews has anything in his Microsoft Access EMail FAQ at
http://www.granite.ab.ca/access/email.htm

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)





.
 
J

jschping

Yes, but i must admit I didn't really get it. It looks like I need to go
through Outlook and somehow program it. I have never done that before.
 
D

Douglas J. Steele

That's exactly what Automation is: you declare a variable that you
instantiate as an instance of the application you're trying to control, then
work programmatically with that variable.

Unfortunately, I don't currently use Outlook at work (we're stuck with Lotus
Notes for another few months), so I don't have any sample code to which I
can point you.
 
D

David C. Holley

Creating emails via Outlook automation is an extremely common task. Adapting
the code is typically straightforward as the examples usually include the
most commonly used properties of the MailItem such as .To, .From, .Subject,
..Body as well as common methods suchas .Send and .Display

This article shows how to send an email from within Excel, but you should be
able to copy and past it directly into Access simply because its Outlook
that you're Automating. Excel, Access, Word, Powerpoint are merely the
applications running the code. Based on the code, you'll need to set a
reference to the Outlook Object Library. The code uses several Outlook
constants which Access won't be able to recognize without the reference. (In
the VBA Editor TOOLS > REFERENCES).
http://www.exceltip.com/st/Control_Outlook_from_Excel_using_VBA_in_Microsoft_Excel/464.html

Full documentation on the MailItem object is here if you need to dig into
the properties and methods
http://msdn.microsoft.com/en-us/library/aa210946(office.11).aspx

If you have problems with it post back to the
[microsoft.public.outlook.general] newsgroup.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top