Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-26-2025, 12:49 AM
BigMac'ro BigMac'ro 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 2016
Novice
VBA macro to send Emails from Word: First line font
 
Join Date: Feb 2025
Posts: 9
BigMac'ro is on a distinguished road
Default VBA macro to send Emails from Word: First line font

Hello,




I'm working on a macro allowing me to send Emails (via Outlook) to several persons. It is based on an Excel-List containing the Email-addresses and on a Word document as the body of the mail. It works quite well, and I just found a way to include the default signature after the mail body


During testing, I was surprised that the first line of the Email is always formatted in a different font. The first line is Times New Roman, size 12; the rest of the mail is in Calibri, size 10. In the source document in Word, everything is Arial, size 10.


Does anyone know where this comes from and how it can be solved?


Here is the code relevant for sending the mails:


Code:
Set objMail = objOutlook.CreateItem(0)
      Dim signature As String                 


' E-Mail settings     
With objMail
         .Display
         signature = objMail.HTMLBody
         .To = strTo
         .Subject = strSubj
         .BodyFormat = 2
         .HTMLBody = strBody & signature
         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
(you will have guessed: strIndivAttach is an array of strings containing the paths to the attachments - but I don't think that's relevant here)


It's also worth noticing that this issue does not occur if I send the Emails without signature - i.e. when I remove
Code:
.Display
signature = objMail.HTMLBody
and have only
Code:
.HTMLBody = strBody
in the code above.


Thank you!
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 02:58 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