change alignment with macro

Can the alignment of a textfield be changed by a macro?

Yes:

oForm = ThisComponent.Drawpage.Forms.getbyname("Your_Form")
oField = oForm.getByName("Your_Field")
oField.Align = 1	'0=Left; 1=Center; 2=Right

If this answers your question please click on the :heavy_check_mark: (upper left area of answer).

I am using Access2Base and it raises an error somewhere in that code.

If I use Drawpage, it comes up with “Drawpage method not found”.
How is that possible?

It would have been helpful if you mentioned Access2Base in your question!

Still, you should be able to do this - YOURCONTROL.Align = 1.