T
Thomas Stein
Hi,
I'm trying to send a mail using Word-VBA using Outlook. But I have to
use a special account (German: Konto) (not my default mail address).
This account already exists in Outlook, and it does send and receive
mails, and it can be selected using the "Account"-Button when creating a
new mail manually.
But how about automation? How can I select the account using VBA?
Example (using Word VBA):
Set oOutlook = CreateObject("Outlook.Application")
If ActiveDocument.Saved = False Then ActiveDocument.Save
Set oiMail = oOutlook.CreateItem(0) ' New e-mail
With oiMail ' define outlook object
.Subject = "Fax to " & faxnr
.Body = ""
.To = faxnr & "@internetfaxservice.eg"
.Account = "(e-mail address removed)" ' <<< VBA-Help says
".Account" exists, but it does not!
.Attachments.Add ActiveDocument.FullName, 1, 1, "Fax"
.Display
On Error Resume Next
.Send ' Gets a runtime error if user does not allow to send mail
from word using vba
End With
Set oiMail = Nothing ' Clean up
Set oOutlook = Nothing
Ciao, Tom
I'm trying to send a mail using Word-VBA using Outlook. But I have to
use a special account (German: Konto) (not my default mail address).
This account already exists in Outlook, and it does send and receive
mails, and it can be selected using the "Account"-Button when creating a
new mail manually.
But how about automation? How can I select the account using VBA?
Example (using Word VBA):
Set oOutlook = CreateObject("Outlook.Application")
If ActiveDocument.Saved = False Then ActiveDocument.Save
Set oiMail = oOutlook.CreateItem(0) ' New e-mail
With oiMail ' define outlook object
.Subject = "Fax to " & faxnr
.Body = ""
.To = faxnr & "@internetfaxservice.eg"
.Account = "(e-mail address removed)" ' <<< VBA-Help says
".Account" exists, but it does not!
.Attachments.Add ActiveDocument.FullName, 1, 1, "Fax"
.Display
On Error Resume Next
.Send ' Gets a runtime error if user does not allow to send mail
from word using vba
End With
Set oiMail = Nothing ' Clean up
Set oOutlook = Nothing
Ciao, Tom