slow-and-steady.... Aesop's fables
Public Sub HyperTable()
Dim ed As Editor = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor
Using t As Autodesk.AutoCAD.DatabaseServices.Transaction = HostApplicationServices.WorkingDatabase.TransactionManager.StartTransaction()
Dim psr As PromptSelectionResult
Dim idArray() As ObjectId
Dim objId As ObjectId
Dim ent As Entity
Try
Dim filterfor() As TypedValue = {New TypedValue(0, "ACAD_TABLE")}
Dim sf As SelectionFilter = New SelectionFilter(filterfor)
psr = ed.SelectAll(sf)
If psr.Status = PromptStatus.OK Then
Dim ss As Autodesk.AutoCAD.EditorInput.SelectionSet = psr.Value
idArray = ss.GetObjectIds()
For Each objId In idArray
Dim br As BlockReference = CType(t.GetObject(objId, OpenMode.ForWrite), BlockReference)
Dim brId As ObjectId = br.BlockTableRecord
Dim btr As BlockTableRecord = CType(t.GetObject(brId, OpenMode.ForWrite), BlockTableRecord)
Dim blkId As ObjectId
For Each blkId In btr
ent = CType(t.GetObject(blkId, OpenMode.ForWrite), Entity)
If ent.GetType.Name = "MText" Then
Dim tblTxt As MText = ent
Dim hlc As HyperLinkCollection = tblTxt.Hyperlinks
Dim hl As New HyperLink()
hl.Name = "http://en.wikipedia.org/wiki/The_Tortoise_and_the_Hare"
hlc.Add(hl)
End If
Next
Next objId
End If
t.Commit()
Catch ex As Exception
Finally
psr = Nothing
idArray = Nothing
objId = Nothing
ent = Nothing
End Try
End Using
End Sub
Works for me.