As a newby to Writer, I have tried to record a macro that changes the current document’s page style to A5 Landscape.
I thought I could do this (as in Microsoft Word) by simply recording a macro and then customising the Writer toolbar to add an icon that would run the macro.
After selecting Tools->Macros->Record Macro, I then input the keystrokes to bring up the Page Style dialog box and make the changes to make paper size and orientation change to A5 Landscape. The document page duly changed accordingly and I then pressed “Stop recording” to finish the macro.
However, when I tried to run the macro, it just brought up the Page Style dialog box for me to make the paper size and orientation changes myself.
Here is the macro that Writer recorded:
sub A5Landscape
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:PageDialog", "", 0, Array())
end sub
Any suggestions please?
Geoff_B
Windows 7 Home Premium Service Pack 1; LibreOffice version 6.2.4.2 (x64); Build ID: 2412653d852ce75f65fbfa83fb7e7b669a126d64; CPU threads: 8; OS: Windows 6.1; UI render: default; VCL: win; Locale: en-GB (en_GB); UI-Language: en-GB Calc: threaded
Edit (Opaque): Formatted code snippet to “preformatted text”