VBA Send_Emails() Help

Tvalli

New Member
Joined
Jul 16, 2019
Messages
3
Happy Friday,

I have a sheet to send monthly and I want to create a button and a code to send it to the same people every month. The button works but the code isn't EXACTLY how I want it.

Here are my issues:

1) My signature is not showing up
2) I can't get the font to be Arial, 11.

Code:
Sub Send_Emails()

  Dim OutlookApp As Outlook.Application
  Dim OutlookMail As Outlook.MailItem

  Set OutlookApp = New Outlook.Application
  Set OutlookMail = OutlookApp.CreateItem(olMailItem)
  
  With OutlookMail
    .BodyFormat = olFormatHTML
    .Display
    .HTMLBody = "[FONT=Arial]"
    .HTMLBody = "Names," & " " & " " & "Please find the worksheets attached." & .HTMLBody
    .To = "name@domain.com"
    .CC = ""
    .BCC = ""
    .Subject = "Monthly Service Worksheets"
    .Attachments.Add ("S:\Staff\TValli\Worksheet 2019.xlsx")
    .Attachments.Add ("S:\Staff\TValli\Worksheet Yearly Summary.xlsx")
    .Send
  End With
    MsgBox ("Your email has been sent")
    
End Sub[/FONT]



Any help is appreciated.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Tvalli,
To get the font to be Arial you’ll need to add <font face=”Arial”> to the beginning of your HTMLBody statement like this:
HTMLBody = <font face=”Arial>”Names,” ….
The font size is a little trickier as the numbers used do not correspond to what we are used to in Excel. Add <font size=”#”> the # sign is replaced with a number between 1 and 7. In the email programs I create I start with <font size= “4”> for normal text. The command is used like this:
HTMLBody = <font face=”Arial><font size=”4”>”Names,” ….
As for your signature, you will need to code that into the end of your HTMLBody lis this:
HTMLBody=HTMLBody & “<br /”> & “ your name”
HTMLBody=HTMLBody & “<br /”> & “ your title”
And so on. My signature takes 7 lines to complete
Hope that helps,
Computerman
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top