Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Text Anchor Position in a CATIA V6 Macro from Excel

Status
Not open for further replies.

RickyPhil

Mechanical
Jul 16, 2014
8
US
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
 
Replies continue below

Recommended for you

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?
 
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?
 
I was able to make it work by using

Text1.anchorPosition = 6

instead of

Text1.anchorPosition = catBottomCenter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top