# Revision history [back]

Thanks to @Mike Kaganski, I looked at the Options - Language Settings - Languages in Writer. I changed the Locale setting to Thai. This brought up a Complex Text layout (CTL) with the default of Hindi; I changed it to Thai. I had tried to record a macro before and it inserted Hindi instead of Thai. This is why. So, I recorded a new macro. It works! Below is the code it generated. Perhaps someone can comment it so we can understand it better. It seems the trick is in the Format value of 20121. Where could we look this up? I must say I''m impressed by the caliber and depth of responses to my question - thanks!

sub Insert_Date_Auto
rem ----------------------------------------------------------------------
rem define variables
dim document   as object
dim dispatcher as object
rem ----------------------------------------------------------------------
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
dim args1(5) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Type"
args1(0).Value = 0
args1(1).Name = "SubType"
args1(1).Value = 0
args1(2).Name = "Name"
args1(2).Value = ""
args1(3).Name = "Content"
args1(3).Value = "0"
args1(4).Name = "Format"
args1(4).Value = 20121
args1(5).Name = "Separator"
args1(5).Value = " "

dispatcher.executeDispatch(document, ".uno:InsertField", "", 0, args1())

end sub