2 Replies Latest reply on Jan 9, 2014 3:32 AM by Sylvain Meallet

    VBA  - Vertical Text Alignment in Note on Drawing

    Sylvain Meallet

      Hi !

       

      I'm desperately trying to find a solution to align the text in a note on a Solidworks Drawing through VBA. The instruction given on the Solidworks Help doesn't work (as written next). VBA says that "property or method isn't handled by this object".

       

       

           Set myNote = Part.InsertNote("Reference")                                       

           Set myAnnotation = myNote.GetAnnotation()

           Set myTextFormat = Part.GetUserPreferenceTextFormat(0)

                 myNote.SetTextJustification (swTextJustificationCenter)                 

      ==>     myNote.SetTextAlignmentVertical (swTextAlignmentMiddle)

                 myTextFormat.CharHeight = 0.004                                           

                 myTextFormat.TypeFaceName = "Times New Roman"                             

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

                 boolstatus = myAnnotation.SetPosition(0.2269, 0.0513, 0)    

       

      Any help would be appreciate.

        • Re: VBA  - Vertical Text Alignment in Note on Drawing
          Simon Turner

          I don't think vertical justification works, even in the UI. Not for simple notes anyway.

          It works for a table annotation.

          Why would you want to vertically justify a note?

            • Re: VBA  - Vertical Text Alignment in Note on Drawing
              Sylvain Meallet

              I try to do a macro in order to automatically create the tittle block on a drawing to install it on all the computers in my company, my aim is to create an userform where you can tip all the modifiable data then simply click on a button to make the tittle block appear. So far we just have pre-made title blocks that we insert in our drawing, but we have to partly manually fill it, and as soon as we need to change something (like the logo of the compagny or the product reference) that means to go through all the old plans, get in the tittle block, change the datas and so on.

               

              So I created the lines and set the position of the texts accurately between those lines, the only problems is that without the vertical justification the text isn't well located. I can cheat and set the position a bit higher but then if somebody want to change the police or if there are several lines in the note, it's not correctly placed anymore.

               

              I don't know if I've been really clear...(haven't spoken english in a while) but if you have any suggestion (I don't know if I could manage it with a table for example) I'd be greatful.