In the last few months, my previously functioning Writer macros stopped working, giving only:
BASIC syntax error.
Expected: Sub.
for each macro in turn (it seems to try to run them all).
At the same time, the "Record Macro’ option is missing from the Tools | Macros menu (there’s only Run, Edit, Organize.
Setting Tools | Options | Security | Macro Security down even as far as ‘Low’ doesn’t resolve it.
I assume this is down to an update, but can’t pin it down.
Windows 10
LO 7.1.5.2 (x64)
Here’s an example of one recorded macro that’s intended simply to insert an em-dash when a key is pressed:
sub emDash
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 ----------------------------------------------------------------------
dim args1(1) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Symbols"
args1(0).Value = "—"
dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, args1())
rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, ".uno:InsertSymbol", "", 0, Array())
end sub