TextToDisplay property

Returns the display text of the specified hyperlink. Read-only String.

Applies to

Objects: Hyperlink

Syntax

object.TextToDisplay

Properties

Part

Description

Object

Required. An expression that returns a Hyperlink object.

Remarks

Example

  Sub FollowFirstLink()
    Dim objApp As New MapPoint.Application
    Dim objMap As MapPoint.Map
    Dim objData As MapPoint.DataSet
    Dim objField As MapPoint.Field
    Dim objPushpin As MapPoint.Pushpin
    Dim objHyperlink As MapPoint.Hyperlink

    'Set up application
    objApp.Visible = True
    objApp.UserControl = True
    Set objMap = objApp.ActiveMap

    'Let the user import data with the wizard
    'There should be one field named "URL"
    Set objData = objMap.DataSets.ShowImportWizard
    If objData Is Nothing Then Exit Sub

    'Make sure that there's a "URL" field
    Set objField = Nothing
    For i% = 1 To objData.Fields.Count
      If UCase(objData.Fields.Item(i%).Name) = "URL" Then
        Set objField = objData.Fields.Item(i%)
        Exit For
      End If
    Next i%
    If objField Is Nothing Then
      MsgBox "Sorry, there is no field named 'URL'"
      Exit Sub
    End If

    'Set the hyperlink field
    Let objData.HyperlinkType = geoHyperlinkField
    Let objData.HyperlinkField = objField

    'Get the hyperlink of the first item in the data set
    Set objPushpin = objData.QueryAllRecords.Pushpin
    Set objHyperlink = objPushpin.Hyperlink

    'Show information about it
    Caption$ = "Information on Pushpin " & objPushpin.Name
    Caption$ = Caption$ & "'s hyperlink:" & vbCrLf & vbCrLf
    Caption$ = Caption$ & "target: " & objHyperlink.Address & vbCrLf
    Caption$ = Caption$ & "bookmark: " & objHyperlink.Subaddress & vbCrLf
    Caption$ = Caption$ & "screen tip: " & objHyperlink.ScreenTip & vbCrLf
    Caption$ = Caption$ & "display text: " & objHyperlink.TextToDisplay
    Caption$ = Caption$ & vbCrLf & vbCrLf
    Caption$ = Caption$ & "Press OK to follow this hyperlink."
    MsgBox Caption$

    'Follow the link
    objHyperlink.Follow
  End Sub