@naveedmX3N25,
This will let you pre-select then change all selected to the same entered value OR let you enter a value then select balloons to change one-by-one:
Dim dDoc As DrawingDocument = TryCast(ThisApplication.ActiveDocument, DrawingDocument)
If IsNothing(dDoc) Then Logger.Debug("Not Run In Drawing Document") : Exit Sub
Dim valueEntered As String = InputBox("Enter the value for the balloon(s):", "Balloon Value")
If valueEntered Is String.Empty Then MsgBox("No value entered") : Exit Sub
If dDoc.SelectSet.OfType(Of Balloon).Count < 1
Dim PickBalloon As Balloon = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingBalloonFilter, "Select a Balloon")
While PickBalloon IsNot Nothing
PickBalloon.BalloonValueSets.Item(1).OverrideValue = valueEntered
PickBalloon = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingBalloonFilter, "Select a Balloon")
End While
Else
Dim SelectedBallons As IEnumerable = dDoc.SelectSet.OfType(Of Balloon)
For Each b As Balloon In SelectedBallons
b.BalloonValueSets.Item(1).OverrideValue = valueEntered
Next
End If
It will create a new undo item for each balloon changed.
This version will batch all the changes into a single transaction envelope:
Dim dDoc As DrawingDocument = TryCast(ThisApplication.ActiveDocument, DrawingDocument)
If IsNothing(dDoc) Then Logger.Debug("Not Run In Drawing Document") : Exit Sub
Dim valueEntered As String = InputBox("Enter the value for the balloon(s):", "Balloon Value")
If valueEntered Is String.Empty Then MsgBox("No value entered.") : Exit Sub
Dim transMan As TransactionManager = ThisApplication.TransactionManager
Dim oTrans As Transaction = transMan.StartTransaction(dDoc, "Batch Balloon Overrides")
On Error GoTo Errrr
If dDoc.SelectSet.OfType(Of Balloon).Count < 1
Dim PickBalloon As Balloon = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingBalloonFilter, "Select a Balloon")
While PickBalloon IsNot Nothing
PickBalloon.BalloonValueSets.Item(1).OverrideValue = valueEntered
PickBalloon = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingBalloonFilter, "Select a Balloon")
End While
Else
Dim SelectedBallons As IEnumerable = dDoc.SelectSet.OfType(Of Balloon)
For Each b As Balloon In SelectedBallons
b.BalloonValueSets.Item(1).OverrideValue = valueEntered
Next
End If
oTrans.End 'Typical transaction end
Exit Sub 'Finish the Sub routine before Error Handling code
Errrr :
MsgBox("Aborted: " & transMan.CurrentTransaction.DisplayName) : transMan.CurrentTransaction.Abort
Exit Sub
Let me know if you have any questions
**Edit: Made corrections to code based on my comment in message 9