Copy a link as hyperlink in email body

annadinesh

Board Regular
Joined
Mar 1, 2017
Messages
56
Dear Team

The RED highlighted Link i want this should copy as hyperlnk in Email Body so that the receiver can click on link and get the location

my Code:

Private Sub CommandButton3_Click()
If ActiveSheet.Name = "Sheet2" Then

If IsEmpty(Worksheets("Sheet2").Range("E3")) Then
Cancel = True
MsgBox ("Email ID Blank"), vbDefaultButton1, "E Mail"

Else
Dim Outlook As Object
Dim email As Object
Dim xInspect As Object
Dim pageEditor As Object
Dim assunto As String, para As String
Dim myRange As Excel.Range

Set Outlook = CreateObject("Outlook.application")
Set email = Outlook.CreateItem(0)

With email
.Subject = "Service Due Reminder of your Hyundai Car"
.To = Range("E3").Value
.Display

Set xInspect = email.GetInspector
Set pageEditor = xInspect.WordEditor

pageEditor.Range.Characters(1).Select
With pageEditor.Application.Selection

.Collapse 1 ' 1 = wdCollapseStart
.InsertAfter "Dear Hyundai Customer," & vbCrLf & vbCrLf & _
"here's the info:" & vbCrLf & vbCrLf & _
"Click Link for Location " & vbCrLf & vbCrLf & vbCrLf

.Collapse 0 ' 0 = wdCollapseEnd
For Each myRange In Sheets("Sheet2") _
.Range("C4:H7").Areas
myRange.CopyPicture Appearance:=xlScreen, Format:=xlBitmap

'.PasteAndFormat Type:=13 ' 13 = wdChartPicture
.PasteSpecial DataType:=4 ' 4 = wdPasteBitmap
.Collapse 0

Next myRange


End With
.Display

Set pageEditor = Nothing
Set xInspect = Nothing

End With
Sheets("Sheet1").Activate
Set email = Nothing
Set Outlook = Nothing

End If
End If
End Sub
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

ranman256

Well-known Member
Joined
Jun 17, 2014
Messages
2,078
Code:
Const Q = """"
With oMail
    .To = "W.E.Coyote@acme.com"
    .Subject = "my subject
    .HTMLBody ="<a href=" & Q & "https://www.w3schools.com/" & Q & ">Visit W3Schools.com!</a>"
end with
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,152,396
Messages
5,769,837
Members
425,574
Latest member
grimeslisa

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
Top