Skip to content

Latest commit

 

History

History
101 lines (70 loc) · 2.7 KB

Publisher.Hyperlink.md

File metadata and controls

101 lines (70 loc) · 2.7 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Hyperlink object (Publisher)
vbapb10.chm4653055
vbapb10.chm4653055
Publisher.Hyperlink
1cc6d95b-357a-c169-a5d2-6850a1a3bbd6
05/31/2019
medium

Hyperlink object (Publisher)

Represents a hyperlink. The Hyperlink object is a member of the Hyperlinks collection and the Shape and ShapeRange objects.

Remarks

Use the Shape.Hyperlink property to return a Hyperlink object associated with a shape (a shape can have only one hyperlink).

Use Hyperlinks (index), where index is the index number, to return a single Hyperlink object from a document, range, or selection.

Use the Add method to add a hyperlink.

Use the Address property to add or change the address to a hyperlink.

Example

The following example deletes the hyperlink associated with the first shape in the active document.

Sub DeleteHyperlink() 
 ActiveDocument.Pages(1).Shapes(1).Hyperlink.Delete 
End Sub

The following example deletes the first hyperlink in the selection.

Sub DeleteSelectedHyperlink() 
 If Selection.TextRange.Hyperlinks.Count >= 1 Then 
 Selection.TextRange.Hyperlinks(1).Delete 
 End If 
End Sub

The following example adds a hyperlink to the selected text.

Sub AddHyperlinkToSelectedText() 
 Selection.TextRange.Hyperlinks.Add Text:=Selection.TextRange, _ 
 Address:="https://www.tailspintoys.com/" 
End Sub

The following example adds a shape to the active publication and then adds a hyperlink to the shape.

Sub AddHyperlinkToShape() 
 With ActiveDocument.Pages(1).Shapes.AddShape _ 
 (Type:=msoShape5pointStar, Left:=200, _ 
 Top:=200, Width:=300, Height:=300) 
 .Hyperlink.Address = "https://www.tailspintoys.com/" 
 End With 
End Sub

Methods

Properties

See also

[!includeSupport and feedback]