View Single Post
 
Old 02-26-2025, 02:19 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 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