AnsweredAssumed Answered

Set balloon uppertext and no leader in macro?

Question asked by Steven Soeder on Mar 17, 2015
Latest reply on May 11, 2015 by Yong Ning

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.

Option Explicit

Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2


Sub mainedit()
    Dim myNote          As SldWorks.Note
    Dim myBalOpt        As SldWorks.BalloonOptions
    Dim myDocExt        As SldWorks.ModelDocExtension
    Dim strLetter       As String
    Dim blnRet          As Boolean
    
    Set swApp = Application.SldWorks
    Set Part = swApp.ActiveDoc
    
    Set myBalOpt = Part.Extension.CreateBalloonOptions()
        
    strLetter = "A"
    
        With myBalOpt
            .Style = swBS_Circular
            .Size = swBF_2Chars
            .UpperTextContent = swBalloonTextCustom
            .UpperText = """"  'have tried setting this to strLetter and even explicitly setting to "A", still gives me a question mark in balloon
            .LowerTextContent = swBalloonTextCustom
            .LowerText = """"
        End With
    
    
    Set myNote = Part.Extension.InsertBOMBalloon2(myBalOpt)
    blnRet = myNote.SetBomBalloonText(myBalOpt.UpperTextContent, strLetter, myBalOpt.LowerTextContent, """")

End Sub

Outcomes