View Single Post
 
Old 08-12-2019, 09:06 AM
WivanS WivanS is offline Windows 10 Office 2016
Novice
 
Join Date: Aug 2019
Posts: 5
WivanS is on a distinguished road
Question Select specific Account after using EnvelopeVisible

With the macro below I can very nicely send my present Word document (2016) using Outlook (2016) as e-mail application.

Sub From_WORD__Outlook()
ActiveWindow.EnvelopeVisible = Not ActiveWindow.EnvelopeVisible
ActiveDocument.MailEnvelope.Introduction = "This is a WORD document"
With ActiveDocument.MailEnvelope.Item
.Recipients.Add "MyAddress@MyMail.com"
.Subject = "Experiment"
End With
End Sub

However, I want to send the e-mail using a specific account. I tried to use the macro below,
but that doesnot changes the default Account as presented in the active Word document. (It does change however the present account in Outlook, but apparently that is not the same as the one presently valid in WORD)

Set objOL = CreateObject("Outlook.Application")
For Each oAccount In objOL.Session.Accounts
If oAccount.DisplayName = "reguired@emailad" Then
Set oMail = objOL.CreateItem(olMailItem)
oMail.SendUsingAccount = oAccount
End If
Next

A second problem is that in Recipients.Add I cannot select a group of preselected accounts from the active addressbook

Can anyone help me solve these problems? Thank you
Regards,
WivanS
Reply With Quote