Remove Hyperlink from Note in Drawing Example (VBA)
This example shows how to remove a hyperlink from a note in a drawing.
'-----------------------------------------------
'
' Preconditions: Note containing a hyperlink is selected.
'
' Postconditions: Hyperlink is removed.
'
' NOTE: Currently
you cannot remove a hyperlink from a note
' in
a drawing using the user interface;
' you
must use the SolidWorks API.
'
'-----------------------------------------------
Option Explicit
Sub main()
Dim
swApp As
SldWorks.SldWorks
Dim
swModel As
SldWorks.ModelDoc2
Dim
swSelMgr As
SldWorks.SelectionMgr
Dim
swNote As
SldWorks.note
Dim
bRet As
Boolean
Set
swApp = CreateObject("SldWorks.Application")
Set
swModel = swApp.ActiveDoc
Set
swSelMgr = swModel.SelectionManager
Set
swNote = swSelMgr.GetSelectedObject5(1)
Debug.Print
"File = " & swModel.GetPathName
Debug.Print
" Note
=
" & swNote.GetName
Debug.Print
" TagName
=
" & swNote.TagName
Debug.Print
" Hyperlink
=
" & swNote.GetHyperlinkText
bRet
= swNote.SetHyperlinkText("")
Debug.Assert
bRet
End Sub