Formatting paragraph into html and copy to clipboard for email

Gaurangg

Board Regular
Joined
Aug 6, 2015
Messages
134
Hi All,

I am trying to write a paragraph into vba code along with some formatting as I want to write some lines in bold, double line break, give hyperlink to email address and at the end I would like to copy entire paragraph into clipboard so I can paste it manually on email body. I am completely unaware about html code so took help from some threads and could do only as below. anyone can please help in this to complete the code?

I would like to write as

Hi John,

Please find below the required information.

Description: (Bold)

Name:
Address:
DOB:
Email: xxxxx@gmail.com (Hyperlink)

Thanks

Code:
Sub Mydata()
Dim s As String
s = "<font size=""10"" face=""Calibri"" color=""black"">" & _
    "Hi John" & "<br>" & _
    "Please find below the required information" & _
    "Description:" & _
    "Name:" & _
    "Address:" & _
    "DOB:" & _
    "Email: xxxx@Gmail.com" & _
    "Thanks:" & _
    "</font>"
End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Posting HTML code in these forums is a bit weird, but I'll post some examples.

Bold:
HTML:
<b>Description</b>

Carriage returns:
HTML:
"Hi John,<br /><br />Please..."

Mailto hyperlinks:
HTML:
<a href=""mailto:xxxxx@gmail.com"">xxxxx@gmail.com</a>

The HTML goes right inside the quotations in VBA as if it was text and then you'll use the HTMLBody syntax to insert into an email.

For HTML syntax, I use this website to get me going: http://pbar.fnal.gov/htmlref.html
 
Upvote 0
I guess the carriage returns didn't make it through the post, but you can see those examples on that website in my previous post.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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