Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Macro: specifying SEND account 1

Status
Not open for further replies.

SteveBoard

Programmer
Nov 1, 2002
35
0
0
US
I'm working on an Outlook macro and also an automation routine in FoxPro that will send a created message to a specific SEND account -- not the default account.

I had thought I could put an account name or number inside the parentheses and out it would go to that target. But that doesn't work.
omailitem.Send()
So can someone advise on the proper syntax? As a work-around, I could change the default send/receive account before running the routine. But there should be an easier way. My routine generates about 75 messages and all of them need to have a specific FROM account name.

 
Will this work

.SentOnBehalfOfName = "mhappe@ipsconsult.com"

the from field will contain this text.

the omailitem.send() just loads the mailitem into the outbox

try this as a test

Mark
 
Will this work

.SentOnBehalfOfName = "mhappe@ipsconsult.com"

the from field will contain this text.

the omailitem.send() just loads the mailitem into the outbox

try this as a test

Private Sub Command1_Click()
Dim myOLApp As New Outlook.Application
Dim myOLItem As Outlook.mailitem
Set myOLItem = myOLApp.CreateItem(olMailItem)
With myOLItem
.Subject = "some subject"
.Body = "some body text."
.To = "someone@some-where.com"
.SentOnBehalfOfName = "me@right-here.com"
End With
myOLItem.Display
myOLItem.Send
End Sub

Mark
 
Mark: Thanks for the answer! That solves my problem.

What reference resources do you use or recommend to get the code right in programming Outlook? I find it very hit or miss to try various syntax on a trial and error basis. I know there is the "advanced reference" in the help list. Also I have used a good book for FoxPro called "Microsoft Office Automation with Visual FoxPro."

Maybe someday, Outlook will have a macro recording feature.

--Steve Board
 
Hey Steve,

Glad it worked. Yes Outlook has very little referenced support. I have a couple of references that I look at once in a while one is Micorsoft Press' Programming Outlook and Exchange by Rizzo. Also VB 6 Programmers reference source by Rahmel Osborne Press has some stuff in it. But with Outlook it is hit or miss. Feel free to contact me if you have other challenges.

Mark
mark@markhappe.com
Naperville, IL
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top