Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
Establece el tipo de destino para el hipervínculo especificado.
Sintaxis
expresión. SetPageRelative (RelativePage)
expresión Variable que representa un objeto Hyperlink .
Parameters
| Nombre | Obligatorio/opcional | Tipo de datos | Descripción |
|---|---|---|---|
| RelativePage | Obligatorio | PbHlinkTargetType | Tipo de destino del hipervínculo. Puede ser una de las constantes PbHlinkTargetType declaradas en la biblioteca de tipos de Microsoft Publisher. |
Ejemplo
En el siguiente ejemplo se agregan cuatro hipervínculos nuevos a la primera forma de la primera página de la publicación activa y se establecen sus destinos correspondientes.
Sub SetHyperlinkRelativeTarget()
Dim hypNew As Hyperlink
Dim txtRng As TextRange
ActiveDocument.Pages(1).Shapes _
.AddTextbox Orientation:=pbTextOrientationHorizontal, _
Left:=10, Top:=10, Width:=200, Height:=200
Set txtRng = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange
txtRng.Text = "First Page" & vbCrLf
Set txtRng = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange
Set hypNew = ActiveDocument.Pages(1).Shapes(1).TextFrame _
.TextRange.Hyperlinks.Add(Text:=txtRng, _
Address:="https://www.tailspintoys.com/")
'Change hyperlink to be a Page-relative link
hypNew.SetPageRelative RelativePage:=pbHlinkTargetTypeFirstPage
txtRng.Collapse pbCollapseEnd
txtRng.Text = "Previous Page" & vbCrLf
Set hypNew = ActiveDocument.Pages(1).Shapes(1).TextFrame _
.TextRange.Hyperlinks.Add(Text:=txtRng, _
Address:="https://www.tailspintoys.com/")
hypNew.SetPageRelative RelativePage:=pbHlinkTargetTypePreviousPage
txtRng.Collapse pbCollapseEnd
txtRng.Text = "Next Page" & vbCrLf
Set hypNew = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.Hyperlinks.Add(Text:=txtRng, _
Address:="https://www.tailspintoys.com/")
hypNew.SetPageRelative RelativePage:=pbHlinkTargetTypeNextPage
txtRng.Collapse pbCollapseEnd
txtRng.Text = "Last Page" & vbCrLf
Set hypNew = ActiveDocument.Pages(1).Shapes(1) _
.TextFrame.TextRange.Hyperlinks.Add(Text:=txtRng, _
Address:="https://www.tailspintoys.com/")
hypNew.SetPageRelative RelativePage:=pbHlinkTargetTypeLastPage
End Sub
Soporte técnico y comentarios
¿Tiene preguntas o comentarios sobre VBA para Office o esta documentación? Vea Soporte técnico y comentarios sobre VBA para Office para obtener ayuda sobre las formas en las que puede recibir soporte técnico y enviar comentarios.