1 Reply Latest reply on Jan 31, 2014 3:38 AM by Simon Turner

    How to set tow font size(heigh) in one Note.

    Yong Ning

      0.jpg

       

      1.jpg

      Record Macro is

       

      Sub main()

      Set swApp = Application.SldWorks

      Set Part = swApp.ActiveDoc
      Set SelMgr = Part.SelectionManager
      boolstatus = Part.Extension.SelectByID2("DetailItem2@Sheet1", "NOTE", 0, 0, 0, False, 0, Nothing, 0)
      Part.FontUnits 18
      Part.FontUnits 6
      End Sub

       

      Question is

      Part.FontUnits 18 → Note font size 18

      Part.FontUnits 6  →  Note font size 6

        • Re: How to set tow font size(heigh) in one Note.
          Simon Turner

          Option Explicit

           

          Dim swApp As SldWorks.SldWorks

          Dim Part As ModelDoc2

           

          Dim boolstatus As Boolean

          Dim longstatus As Long, longwarnings As Long

           

          Sub main()

           

              Set swApp = Application.SldWorks

             

              Set Part = swApp.ActiveDoc

             

              Dim myNote As Note

              Dim myAnnotation As Annotation

              Dim myTextFormat As TextFormat

             

              Set myNote = Part.InsertNote("<FONT style=B>Some Bold Text<FONT style=RB> Normal Text")

              If Not myNote Is Nothing Then

                 myNote.LockPosition = False

                 myNote.Angle = 0

                 boolstatus = myNote.SetBalloon(0, 0)

                 Set myAnnotation = myNote.GetAnnotation()

                 If Not myAnnotation Is Nothing Then

                    longstatus = myAnnotation.SetLeader3(swLeaderStyle_e.swNO_LEADER, 0, True, False, False, False)

                    boolstatus = myAnnotation.SetPosition(0.171629839646758, 0.235369230769231, 0)

                    boolstatus = myAnnotation.SetTextFormat(0, True, myTextFormat)

                 End If

              End If

              Part.ClearSelection2 True

              Part.WindowRedraw

          End Sub