saving a macro that formats cells as text to an extension

  Kiến thức lập trình

I have this calc macro that is working as expected.
It formats the cells as “text” so that I can type February 2024 without any problem.

Is it possible to save this macro as an extension?


sub DisableAutoFormat
dim document   as object
dim dispatcher as object

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "NumberFormatValue"
args1(0).Value = 100

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

end sub

LEAVE A COMMENT