Insert Text Hyperlink in Body of Email

S

Sandy Winkelman

What is the correct syntax to turn text into a hyperlink and place it at the curser in an email?

Following is my code. I would like make the words "Visit this site" as the hyperlink and remove web address from the sentence.

Sub InsertLink()
Const sText As String = "Visit this site: https://www.cwmdiecast.com"
On Error GoTo ErrHandler
If TypeName(ActiveWindow) = "Inspector" Then
If ActiveInspector.IsWordMail And ActiveInspector.EditorType = olEditorWord Then
ActiveInspector.WordEditor.Application.Selection.TypeText sText
End If
End If
Exit Sub
ErrHandler:
Beep
End Sub
 
M

Michael Bednarek

What is the correct syntax to turn text into a hyperlink and place it at the curser in an email?

Following is my code. I would like make the words "Visit this site" as the hyperlink and remove web address from the sentence.

Sub InsertLink()
Const sText As String = "Visit this site: https://www.cwmdiecast.com"
On Error GoTo ErrHandler
If TypeName(ActiveWindow) = "Inspector" Then
If ActiveInspector.IsWordMail And ActiveInspector.EditorType = olEditorWord Then
ActiveInspector.WordEditor.Application.Selection.TypeText sText
End If
End If
Exit Sub
ErrHandler:
Beep
End Sub

Have you tried "Visit <a href="https://www.cwmdiecast.com">this site.</a>" ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top