Edit Balloon Example (VBA)
This example shows how to edit a balloon in a drawing document.
'
--------------------------------------------------------------------------
' Preconditions:
' 1. Open:
' <SolidWorks_install_dir>\samples\tutorial\advdrawings\foodprocessor.slddrw
' 2. Click Insert > Annotations > Balloon.
' 3. Click a model edge in either drawing view and add the balloon.
' 4. Close the Balloon PropertyManager page.
' 5. Select the balloon in the drawing.
'
' Postconditions:
' A balloon is added to the selected model
edge and then modified.
'
' NOTES: Because this drawing document is used in a
' SolidWorks
online tutorial, do not save any
' changes
made to the document when closing it.
'
--------------------------------------------------------------------------
Option Explicit
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swModelDocExt As SldWorks.ModelDocExtension
Dim swDrawing As SldWorks.DrawingDoc
Dim swSelMgr As SldWorks.SelectionMgr
Dim swNote As SldWorks.Note
Dim boolstatus As Boolean
Sub main()
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swModelDocExt = swModel.Extension
Set swSelMgr = swModel.SelectionManager
Set swDrawing = swModel
boolstatus = swModel.ActivateView("Drawing
View1")
' Get the selected balloon
Set swNote = swSelMgr.GetSelectedObject6(1,
-1)
' Edit the selected balloon
Set swNote = swModelDocExt.EditBalloonProperties(swBS_Circular,
swBF_4Chars, swDetailingNoteTextQuantity, "Upper Text 2", swDetailingNoteTextQuantity,
"Balloon Lower Text", 0, True, 2, "Denotation")
' Balloon is actually a note
Debug.Print "Balloon name: "
& swNote.GetName
End Sub