×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Changing Text Anchor Position in a CATIA V6 Macro from Excel

Changing Text Anchor Position in a CATIA V6 Macro from Excel

Changing Text Anchor Position in a CATIA V6 Macro from Excel

(OP)
I have a macro where I am taking text from a spreadsheet and using it to create text in a CATIA V6 drawing. I can get the text in fine and I can change the font size, but I can't get the .AnchorPosition method to work. I get the error message, "The method AnchorPosition failed."

'Creates text
Set Text1 = CATIA.ActiveEditor.ActiveObject.Sheets.ActiveSheet.Views.ActiveView.Texts.Add(CStr(Range("A1").Value), 0, 0)
'Set font size
Text1.SetFontSize 0, 0, 0.15 * 25.4
'vvv The macro fails here vvv
Text1.anchorPosition = catBottomCenter

RE: Changing Text Anchor Position in a CATIA V6 Macro from Excel

(OP)
The above code (excecept with a string instead of a reference to a cell) works if I run it from the CATIA macro editor. Why is there a difference?

RE: Changing Text Anchor Position in a CATIA V6 Macro from Excel

(OP)
I am useing dots for non-integer numbers. Is there anything else you meant by reginal settings?

I think I have the right references in the Excel VBA. The macro creates the text and changes the font size. It just won't change the anchor position. Is there something the .AnchorPosition needs that the .SetFontSize doesn't?

RE: Changing Text Anchor Position in a CATIA V6 Macro from Excel

(OP)
I was able to make it work by using

Text1.anchorPosition = 6

instead of

Text1.anchorPosition = catBottomCenter

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources