Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 08-12-2019, 08:51 PM
gmayor's Avatar
gmayor gmayor is offline Select specific Account after using EnvelopeVisible Windows 10 Select specific Account after using EnvelopeVisible Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,138
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Instead of mailenvelope, try the following

Code:
Sub Send_As_HTML_EMail()
'Graham Mayor - http://www.gmayor.com - Last updated - 14 Jul 2017
'Requires the code from http://www.rondebruin.nl/win/s1/outlook/openclose.htm
'to either retrieve an open instance of Outlook or open Outlook if it is closed.
Dim bStarted As Boolean
Dim olApp As Object
Dim oItem As Object
Dim oAccount As Object
Dim objDoc As Object
Dim objSel As Selection
Dim strRecipient As String
Dim strSubject As String
Dim strAccount As String

    strRecipient = "someone@somewhere.com"
    strSubject = "This is the message subject"
    strAccount = "account display name"

    ActiveDocument.Range.Copy
    Set olApp = OutlookApp()

    For Each oAccount In olApp.Session.Accounts
        If oAccount.DisplayName = strAccount Then
            Set oItem = olApp.CreateItem(0)
            With oItem
                Set .SendUsingAccount = oAccount
                .BodyFormat = 2
                .Display
                Set objDoc = .GetInspector.WordEditor
                Set objSel = objDoc.Windows(1).Selection
                objSel.PasteAndFormat Type:=wdFormatOriginalFormatting
                .To = strRecipient
                .Subject = strSubject
                '.Send
            End With
            Exit For
        End If
    Next oAccount
lbl_Exit:
    Set oItem = Nothing
    Set oAccount = Nothing
    Set olApp = Nothing
    Set objDoc = Nothing
    Set objSel = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot change/select/Add older .PST file from Account Settings n O2016 Hixpix Outlook 0 09-26-2017 03:51 AM
Select specific Account after using EnvelopeVisible How do I select all text highlighted in a specific colour? bertietheblue Word 2 04-15-2016 12:30 PM
Select specific Account after using EnvelopeVisible signature for specific account Mr.T Outlook 1 02-17-2015 03:10 PM
Mark BCC when emails is sent from specific account vijanand1279 Outlook 0 05-27-2014 09:59 PM
Select specific Account after using EnvelopeVisible Using ActiveWorkbook.EnvelopeVisible = True to send part of a sheet as an email. bshawnr Excel Programming 1 04-12-2014 05:02 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:30 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft