![]() |
#1
|
|||
|
|||
![]()
I have the following code in an Outlook class in my Access database:
Code:
Public Sub CreateEMail(strETo As String, strECC As String, strESubject As String, strEBody As String, _ ParamArray attachFiles() As Variant) Dim attachFile As Variant Set olEmail = olApp.CreateItem(olMailItem) With olEmail .To = strETo .CC = strECC If Not IsNull(olAccount) Then .SendUsingAccount = olAccount .Sender = olAccount End If .Subject = strESubject .HTMLBody = strEBody & "<br>" & .HTMLBody ' .body = Application.plainText(strEBody) & vbCrLf & .body For Each attachFile In attachFiles If attachFile <> "" Then .Attachments.Add attachFile Next If m_autoSend Then .Send Else .Display End If End With End Sub When the code is executed, I end up with an open Outlook email message ready to complete and send. This is good. What's not good is the wrong email address (number 1 in my account list) is shown in the message, and I need to click the drop-down and choose the correct one (number 2 in my account list) in the message UI. If I single step the code, the correct Outlook account is being chosen, but when the outgoing message is displayed, it's the wrong account. Any ideas to fix this? Thanks... |
Tags |
automating outlook, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Cannot Access Email in MS 365 - Licensing Issue? | DeborahG | Outlook | 0 | 06-01-2020 08:16 AM |
![]() |
MACH1 | Outlook | 3 | 07-03-2016 03:18 AM |
Can't create new email or access email acounts Outlook 2003 | onthebeaches | Outlook | 1 | 02-20-2012 10:21 PM |
![]() |
PhilAJ | Mail Merge | 4 | 05-23-2011 04:42 AM |
![]() |
RMittelman | Outlook | 1 | 02-07-2011 03:11 PM |