R
Rosemary
I basically copied the code from
http://msdn.microsoft.com/en-us/library/bb207787.aspx
to try to set the "From" in an email to an email address of my choice.
I can't make it work. It is word for word from the web site, except for my
e-mail address in the Receipients.add and setting the value for oAccount.
When I compile it I get an error "Method or data member not found" on the
..session
I've looked in the object explorer and it is valid.
I added references for anything Outlook.
What am I doing wrong?
Private Sub SendUsingAccount_Click()
Dim oAccount As Outlook.Account
oAccount = "(e-mail address removed)"
For Each objNamespace In Application.Session.Accounts
If oAccount.AccountType = olPop3 Then
Dim oMail As Outlook.MailItem
Set oMail = Application.CreateItem(olMailItem)
oMail.Subject = "Sent using POP3 Account"
oMail.Recipients.Add ("(e-mail address removed)")
oMail.Recipients.ResolveAll
oMail.SendUsingAccount = oAccount
oMail.Send
End If
Next
End Sub
http://msdn.microsoft.com/en-us/library/bb207787.aspx
to try to set the "From" in an email to an email address of my choice.
I can't make it work. It is word for word from the web site, except for my
e-mail address in the Receipients.add and setting the value for oAccount.
When I compile it I get an error "Method or data member not found" on the
..session
I've looked in the object explorer and it is valid.
I added references for anything Outlook.
What am I doing wrong?
Private Sub SendUsingAccount_Click()
Dim oAccount As Outlook.Account
oAccount = "(e-mail address removed)"
For Each objNamespace In Application.Session.Accounts
If oAccount.AccountType = olPop3 Then
Dim oMail As Outlook.MailItem
Set oMail = Application.CreateItem(olMailItem)
oMail.Subject = "Sent using POP3 Account"
oMail.Recipients.Add ("(e-mail address removed)")
oMail.Recipients.ResolveAll
oMail.SendUsingAccount = oAccount
oMail.Send
End If
Next
End Sub