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
'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
RE: Changing Text Anchor Position in a CATIA V6 Macro from Excel
What are your regional settings in Windows OS? Are you using dot or comma for numbers which are not integers? Do you have the right references in Excel vba?
Regards
Fernando
https://picasaweb.google.com/102257836106335725208
https://picasaweb.google.com/103462806772634246699...
RE: Changing Text Anchor Position in a CATIA V6 Macro from Excel
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
Text1.anchorPosition = 6
instead of
Text1.anchorPosition = catBottomCenter