How can i make subject bold in mail vba code
In VBA, you can use the Format
method to make the subject of an email bold. Here's an example code:
Dim olApp As Object
Dim olMail As Object
Set olApp = CreateObject("Outlook.Application")
Set olMail = olApp.CreateItem(0) ' 0 = olMailItem
olMail.Subject = "**Your Bold Subject**" ' Use double asterisks to make the subject bold
olMail.Body = "This is the body of the email"
olMail.Send
Alternatively, you can use the Font
property to set the font style of the subject to bold:
olMail.Subject = "Your Subject"
olMail.Subject.Font.Bold = True
Note that the second method will make the entire subject bold, including any spaces or punctuation. If you only want to make certain parts of the subject bold, you can use a combination of the Format
method and the Font
property:
olMail.Subject = Format("Your **Bold** Subject", "Your [b]Bold[/b] Subject")
This will make the word "Bold" bold, while leaving the rest of the subject in regular font.