I am trying to write a macro to generate balloons with a single letter in them.
I'm having no luck getting the UpperText property to set.
I've tried setting it in the BalloonOptions object, prior to calling the InsertBomBalloon method and I've tried setting it after creating the balloon, using the SetBomBalloonText method.
No matter what I do, the text is always just a question mark.
The other problem I am having, is that the balloon is created with a leader. I don't want a leader. I just want a leaderless balloon.
I'm not sure where to set this option; I don't see any type of leader property listed in the class members for INote or IBalloonOptions objects in the documentation.
Hoping someone else knows this. I'm sure this exists somewhere, but I'm just not finding it.
Here is where I'm at right now.
Like I mentioned, I've also tried setting it in the balloon options prior to creation and I was still getting a question mark. That's actually why I broke it out into separate create and modify operations. I would prefer to keep it one operation if possible - just set the text at creation and not have to modify it.
<p>Option Explicit</p><p></p><p>Dim swApp As SldWorks.SldWorks</p><p>Dim Part As SldWorks.ModelDoc2</p><p></p><p></p><p>Sub mainedit()</p><p> Dim myNote As SldWorks.Note</p><p> Dim myBalOpt As SldWorks.BalloonOptions</p><p> Dim myDocExt As SldWorks.ModelDocExtension</p><p> Dim strLetter As String</p><p> Dim blnRet As Boolean</p><p> </p><p> Set swApp = Application.SldWorks</p><p> Set Part = swApp.ActiveDoc</p><p> </p><p> Set myBalOpt = Part.Extension.CreateBalloonOptions()</p><p> </p><p> strLetter = "A"</p><p> </p><p> With myBalOpt</p><p> .Style = swBS_Circular</p><p> .Size = swBF_2Chars</p><p> .UpperTextContent = swBalloonTextCustom</p><p> .UpperText = """" 'have tried setting this to strLetter and even explicitly setting to "A", still gives me a question mark in balloon</p><p> .LowerTextContent = swBalloonTextCustom</p><p> .LowerText = """"</p><p> End With</p><p> </p><p> </p><p> Set myNote = Part.Extension.InsertBOMBalloon2(myBalOpt)</p><p> blnRet = myNote.SetBomBalloonText(myBalOpt.UpperTextContent, strLetter, myBalOpt.LowerTextContent, """")</p><p></p><p>End Sub</p>SolidworksApi macros
