https://bugs.documentfoundation.org/show_bug.cgi?id=160685

Rafael Lima <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #1 from Rafael Lima <[email protected]> ---
Are you running this script from within a document?

If so, I recommend you create a function and make it available as a script. To
do this, follow the example "Creating Python script files" in the following
help page:

https://help.libreoffice.org/latest/en-US/text/sbasic/shared/03/sf_intro.html

It would be something like:

from scriptforge import CreateScriptService

# This is your macro
def my_script(args=None):
    doc = CreateScriptService("Calc")
    # Here you can do whatever you want with 'doc'

# Here you make the macro available
g_exportedScripts = (my_script, )

Now you can go to Tools - Macros - Run Macro. Under "My Macros", search the
module you've just created (it will be the name of the Python file without the
.py), and then you can select 'my_macro' and run it.

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to