Since you didn't seem to understand the hint I gave how about a lesson in using the MRI tool.
Assuming you have installed and enabled the MRI extension.
Near the beginning of your macro insert the following code to make sure the MRI tool is available inside your macro (the MRI library is loaded and the UNO service is started)
Code: Select all
If Not Globalscope.BasicLibraries.isLibraryLoaded("MRILib") Then
Globalscope.BasicLibraries.LoadLibrary( "MRILib" )
End If
oMRI = CreateUnoService( "mytools.Mri" )
Using ThisDatabaseDocument directly in macro statements can be risky. While it isn't likely to be an issue in your little macro you should get in the habit of assigning it with something like
using oDoc throughout the remainder of the macro is safer. Your assignment of “rp” becomes
Code: Select all
rp = oDoc.ReportDocuments.getByName(getDocTitle)
Insert the following statement after you have assigned “oDoc” and before you assign “rp”
Open the IDE (<Alt> F11). Locate your macro and select Edit. Set a breakpoint on the line “rp = oDoc.ReportDocuments.getByName(getDocTitle)” and then click on the Run icon.
Execution should stop at the line with the breakpoint and you should also now see a MRI dialog.
By default the MRI dialog opens with the Properties tab selected.
Scroll through the list of properties and select “ReportDocuments”
Now select the Methods tab in the MRI dialog.
Scroll through the list of methods and select “getByName”.
You should get a popup list of items in the main Reports folder. One of those items should be the name of the Folder where your report is stored. Select that item.
Scroll through the methods list and again select “getByName”. A new list should popup this time your report name should be on the list. Select that item.
If it hasn't occurred to you what needs to changed in your macro press <Ctrl> h and a new pane should open at the bottom of the MRI dialog. It displays the code used to access your report. You can copy this code into the clipboard.
In the IDE stop the macro execution. Paste the contents of the clipboard into your macro.
Finally, edit the “rp” assignment in include the inserted code.
You can either delete the lines of code used to access the MRI tool or better yet change them to comments in case you need them at some future date.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11