URL property example
Sub HyperLinks_Example()
    Dim oMtext As AcadMText
    Dim sTextString As String
    Dim insPt(0 To 2) As Double: insPt(0) = 0: insPt(1) = 9
    sTextString = "\LSelect text, then right-click and use Hyperlink>Open"
    Set oMtext = ThisDrawing.ModelSpace.AddMText(insPt, 18, sTextString)
    oMtext.height = 1
    oMtext.width = 18
    oMtext.Update
    ThisDrawing.Application.ZoomExtents
    
    Dim Hyperlinks As AcadHyperlinks
    Dim Hyperlink As AcadHyperlink
    Set Hyperlinks = oMtext.Hyperlinks
    
    Set Hyperlink = Hyperlinks.Add("Bricsys")
    Hyperlink.URL = "http://www.bricsys.com/en_INTL/bricscad/"
    Hyperlink.URLDescription = "The BricsCAD Site"
    Hyperlink.URLNamedLocation = "BricsCAD"
    
    Dim sBuf As String
    For Each Hyperlink In Hyperlinks
        sBuf = sBuf & "____________________________________" & vbCrLf
        sBuf = sBuf & "URL: " & Hyperlink.URL & vbCrLf
        sBuf = sBuf & "URL Description: " & Hyperlink.URLDescription & vbCrLf
        sBuf = sBuf & "URL Named Location: " & Hyperlink.URLNamedLocation & vbCrLf
    Next
    MsgBox "The Mtext object has " & Hyperlinks.count & " Hyperlink: " & vbCrLf & sBuf
End Sub
| ©  Bricsys NV. All rights reserved. |