Base error message BASIC runtime error. Property or method not found: drawpage

I’m running the latest version of Libre Office (7.4.6.1) and I’ve read a lot of the responses to this issue and as advised in the Base Guide, used their sample code *excerpt)

Sub Main
Dim oDoc As Object
Dim oDrawpage As Object
Dim oForm As Object

oDoc = thisComponent
oDrawpage = oDoc.drawpage
oForm = oDrawpage.forms.getByName(“MainForm”)
End Sub

Even before I start develooing the rest of the macro, I get a dialogue showing 
"BASIC runtime error. Property or method not found: drawpage"

I've tried moving the code to different modules, renaming forms, but as it gets to the drawpage declaration I get the error.

I've also looked at the various sample db's provided as well as built new ones. It just doesnt work, so I'm assuming there is perhaps a module that needs to be installed or some other setting I'm missing?

Thanks.

Might be you try to start the macro in macro editor. But macro will nee a form to start form. This form document is “thisComponent”.
If you start in the macro editor “thisComponent” is the editor. And the editor contains no drawpage.

Thanks for your quick response and advice.
I’ve moved the macro to suitable events in the form, but I fear it is not working because of the MacOS which no longer gives the option to enable macros. I’ve looked everywhere for a solution, but just get bombarded with ‘enabling Excel macros’
Any ideas would be welcome.
Thanks
Chris

Chris

Yo are using a Mac. Don’t know where it is on a Mac, but on Linux and Windows it is Tools → Options → LibreOffice → Security and there the button Macro Security. It is the dialog where all settings in LibreOffice will be made.

Macro Security is set here to Medium. So I’m asked every time a document with macros opens if I would allow macro execution. I have also set in Trusted Sources → Trusted File Locations a special folder in my home directory. So I’m not asked for executing macros if a file is saved in this directory.