Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-26-2025, 02:19 AM
gmayor's Avatar
gmayor gmayor is offline VBA macro to send Emails from Word: First line font Windows 10 VBA macro to send Emails from Word: First line font Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,144
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

You could use the Outlook word editor to do whatever you wish with the message body e.g. in the following example wdDoc is the message body, and oRng is the range in question. By collapsing the range to the start, you can retain the default signature associated with the account. If you want to lose the signature, don't collapse the range.
If you want to keep all the formatting in the original document, copy the document range and paste it to oRng instead of formatting a text string.


Or you could simply use E-Mail Merge Add-in

Code:
Dim olInsp As Object
Dim objMail As Object
Dim wdDoc As Object
Dim oRng As Object

Set objMail = objOutlook.CreateItem(0)


' E-Mail settings
    With objMail
        .To = strTo
        .Subject = strSubj
        .BodyFormat = 2
        
        Set olInsp = .GetInspector
        Set wdDoc = olInsp.WordEditor
        Set oRng = wdDoc.Range
        oRng.Collapse 1
        .Display
         oRng.Text = strBody
         oRng.Font.Name = "Arial"
         oRng.Font.Size = 10
         For a = LBound(strIndivAttach) To UBound(strIndivAttach)          ' in case there are several attachments
             If Dir(strIndivAttach(a)) <> "" Then
                 .Attachments.Add (strIndivAttach(a))
             End If
         Next a
         .send   ' Send
     End With
__________________
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
 

Tags
vba



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can send emails, cannot receive emails! jpcummins Outlook 0 09-02-2020 02:39 PM
VBA macro to send Emails from Word: First line font Bigger font on first letter of first line leaves large gap on that line CrossReach Word 1 04-12-2016 09:23 AM
VBA macro to send Emails from Word: First line font Send Emails from MailMerge in Word using Specified Email Address Baldeagle Mail Merge 6 07-25-2015 05:32 AM
VBA macro to send Emails from Word: First line font macro to add brackets to each line and add single quotes to each word in the line bracketandquotes Word VBA 17 02-16-2015 03:51 PM
How to change line height for marked text (in Word 2007)? ... as default for font? pstein Word 1 01-14-2012 10:15 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:40 PM.


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