[Solved] Need to remove macro from LO Base and Basic

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
widowmaker
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

[Solved] Need to remove macro from LO Base and Basic

Post by widowmaker »

I am trying to remove an old Macro from LO Base. I have already tried to "delete it" but it keeps coming back.

I know people have been complaining about trying to delete Macro's from Documents and Spreadsheets, but have not found any responses about removing it from a database. BTW, yes I did go into the Tools/Macro?Organize and tried to delete it, but that didn't work.

I went into the "config" folder and "basic" subfolder in order to "rename" the "Library" in multiple folders, as a test to locate the files and now it gives me an error, instead of the standard warning about the Macro. Yes, I can go back and rename them back to the original names again to get rid of the errors, but that will not totally remove them.

I also tried creating a brand new database, but still get the same error, which tells me there has to be another file calling it up.

Short of deleting LO and reloading a brand new install or changing to a different Database Program, what are my options to get rid of this Macro?

Thanks for any advise
Last edited by widowmaker on Wed Jun 10, 2020 2:15 pm, edited 1 time in total.
LibreOffice 6.0.7.3 on Linux Mint 19.3
User avatar
Zizi64
Volunteer
Posts: 11352
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Need to remove macro from LO Base and Basic

Post by Zizi64 »

What do you mean by "old Macro"? Where you stored that macro? In a file or in the MyMacros?

If the answer is "in a file", the please upload a problematic Base file here.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: Need to remove macro from LO Base and Basic

Post by JeJe »

Have you gone to Tools menu/Customise/Events tab and checked there are no macros assigned there - either to save in LibreOffice or save in your document options?
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need to remove macro from LO Base and Basic

Post by Villeroy »

I use LO 6.0 (the one which is shipped with Ubuntu 18.4) and have a Base document with

Standard
--> Module1
MyLib
--> Module1
--> Module2

There is no Python or any other code embedded.

I save a copy in a non-trusted filder, open the copy, get the macro warning.
I call the macro organizer, delete Standard.Module1, and the entire "MyLib".
The Basic code is no longer visible.
I save and close the document.
When I open the document again, I get the same macro warning even though the macro organizer does not show any macros and there is no Basic folder nor any Scripts folder in the zip.
LO 7.0(beta) and AOO 4.1.7 show the macro warning when opening the file from a non-trusted directory.
I attach the naked document. It is connected to a local HSQL2 which does not matter in this particular case because we don''t need to access any database.
Attachments
Konten.odb
(8.02 KiB) Downloaded 216 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
widowmaker
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Post by widowmaker »

Zizi64 wrote:What do you mean by "old Macro"? Where you stored that macro? In a file or in the MyMacros?

If the answer is "in a file", the please upload a problematic Base file here.
I created the Macro using using Tools > Macros > Organize macros > LibreOffice Basic.
The name of the Library is still there below the Standard Library.
The Standard Library has 2 Modules that are both empty or I should say do not display any files.

The Library I created is still there but the modules and contents are not displayed and the EDIT button is grey, so it can not be clicked. Also, I can not change or delete it's name.

However, in spite of no Macros being displayed in these Modules or Libraries, I still kept getting messages stating the document contains Macros.

So I tracked down the location of the Macros and found them in
file:///home/user/,config/libreoffice/4/user/basic/libraryname/script.xlb/:

At that point, I opened the folder containing the same name as the Macro I created and discovered it still contained files. So, instead of deleting the files, I renamed the folder as a test to see if it would eliminate the messages stating the document contained Macros.

After renaming the folder, I kept getting the same message stating the document contained Macros, but then after dismissing that message, I also got a message stating their was an error loading BASIC of the document file:///home/user/,config/libreoffice/4/user/basic/libraryname/script.xlb/:

That led me to one plain fact. Somewhere within LO Base, there is another file that is still calling out the Macro and I am trying to find the location of that file, in order to see if the "call" to the Macro can be deleted.
Thanks
LibreOffice 6.0.7.3 on Linux Mint 19.3
JeJe
Volunteer
Posts: 2763
Joined: Wed Mar 09, 2016 2:40 pm

Re: Need to remove macro from LO Base and Basic

Post by JeJe »

Have you looked through your other libraries and modules to see if you can find somewhere within a sub which calls the macro?

One option would be to reinstate the macro but with nothing in it - it will be called and will run successfully but nothing will happen. eg

Code: Select all

sub yoursubname()
end sub
You can also comment out a macro so nothing runs with ' in front of every line

Code: Select all

sub yoursubname()
' line of code
' line of code
end sub
or put exit sub or exit function if its a function at the start

Code: Select all

sub yoursubname()
Exit sub
'nothing else will run
end sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
widowmaker
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Post by widowmaker »

JeJe wrote:Have you looked through your other libraries and modules to see if you can find somewhere within a sub which calls the macro?

One option would be to reinstate the macro but with nothing in it - it will be called and will run successfully but nothing will happen. eg

Code: Select all

sub yoursubname()
end sub
You can also comment out a macro so nothing runs with ' in front of every line

Code: Select all

sub yoursubname()
' line of code
' line of code
end sub
or put exit sub or exit function if its a function at the start

Code: Select all

sub yoursubname()
Exit sub
'nothing else will run
end sub
Thank you for that information. I will take a look at it.
In the meantime, I just went into the .config folder and made copies of all the original files and folders in the Basic folder.

I then went into the original dialog.xlc file and the oridinal dialog.xlc file and deleted all lines relating to the Library name I wanted to delete.

I also went into the Standard Folder and deleted the lines calling for the library I wanted to get rid of, and deleted them in the Script.xlb file and the dialog.xlb file.

This got rid of all my errors. However, when I open the database, it still claims I have a Micro in the database somewhere, so my hunt for a hidden file somewhere still exists.

BTW, my goal in eliminating any reference to a Macro is strictly a security issue. I don't want ANY macros to show upin my db at all. That way if I ever get a warning, I will know there is a problem. Since I manage 30+ websites on this particular machine, I can not afford to have any type of virus sneak in through a Macro.
Thanks
LibreOffice 6.0.7.3 on Linux Mint 19.3
widowmaker
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Post by widowmaker »

JeJe wrote:Have you gone to Tools menu/Customise/Events tab and checked there are no macros assigned there - either to save in LibreOffice or save in your document options?
Thank you for that tip about checking the Tools/Customize/Events tab. I had not realized you could check for Assigned Actions in that location.

As it turned out, I did not have any actions assigned to this database, but at least now I have one more tool to rely on in the future. I appreciate the info.
LibreOffice 6.0.7.3 on Linux Mint 19.3
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Need to remove macro from LO Base and Basic

Post by RoryOF »

If you know the name of the macro, you could search through the OO User Profile directory, using the computer search, for any file containing the macro name in its content.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need to remove macro from LO Base and Basic

Post by Villeroy »

We still don't know the version of LibreOffice. Is it the 6.0 version that is distributed with Ubuntu/Mint?
Do you get any warnings or error messages? If so what do they say exactly?
We still don't know where the macros are stored. "My Macros" or embedded in the database document. I guess it is the latter.
The name of the Library is still there below the Standard Library.
There is MyMacros>Standard with code modules and there is YourDatabaseDocument.odb.Standard with its own code modules. Is it the Standard library of MyMacros or is it the Standard library within your database document?
In the screenshot, MyMacros>Standard is the highlighted one with many modules "Dialog1", "DispatchChars" etc.
Konten.odb>Standard is the one near the bottom with 2 modules "Module1" and "SetFilter".
Konten.odb has a second library "Import" with modules "KontoImport" and "Module1".

In today's posting posting.php?mode=reply&f=20&t=102205#pr493739 I attached a copy of that document where I managed to strip all Basic code, removed all forms and reports with LO 6.0 (Ubuntu) and still get a warning about embedded macros when opening the document with any version of AOO/LO.
Attachments
Standard libs in MyMacros and document.
Standard libs in MyMacros and document.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
widowmaker
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Post by widowmaker »

RoryOF wrote:If you know the name of the macro, you could search through the OO User Profile directory, using the computer search, for any file containing the macro name in its content.
Since there are 2 of us trying to get solutions here, i am getting confused by the replies. Anyway, by deleting the files I mentioned in my post above, I am now able to create new databases without getting a message stating they contain macros.

I am also able to access about 10 old databases without any macros warning messages, however I still have around 20 databases where I am still getting the warning messages stating they contain Macros, when they do not.

What I would like to know now, is where is the file located that sends out the message stating macros exist in a particular database.
Thanks
LibreOffice 6.0.7.3 on Linux Mint 19.3
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need to remove macro from LO Base and Basic

Post by Villeroy »

If an error message states, that the document contains macros, then file:///home/user/,config/libreoffice/4/user/basic/libraryname/script.xlb/: is not the place where to search. This is the location of "My Macros". Macros stored in that place are not embedded in any document.
This is why I try to clarify:
Embedded or not?
Which exact warning?
Which exact version of LibreOffice? See menu:Help>About LibreOffice. Since LO 6.4 there are new issues with macros.
-------------------------
The topic reads: "Need to remove macro from LO Base and Basic"
It should be: "Need to remove Basic macro from Base document or from LO"
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
MrProgrammer
Moderator
Posts: 4894
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Need to remove macro from LO Base and Basic

Post by MrProgrammer »

Villeroy wrote:There is no Python or any other code embedded. I save a copy in a non-trusted filder, open the copy, get the macro warning. I call the macro organizer, delete Standard.Module1, and the entire "MyLib". The Basic code is no longer visible. I save and close the document. When I open the document again, I get the same macro warning even though the macro organizer does not show any macros and there is no Basic folder nor any Scripts folder in the zip.
There are no script files, but a directory exists.
Downloads 561 $ cd ~/Downloads
Downloads 562 $ file=Konten.odb
Downloads 563 $ pdir=Scripts/python
Downloads 564 $ unzip -l "$file"
Archive:  Konten.odb
  Length      Date    Time    Name
---------  ---------- -----   ----
       39  06-03-2020 12:14   mimetype
    47403  06-03-2020 12:14   settings.xml
    23499  06-03-2020 12:14   content.xml
        0  06-03-2020 12:14   Scripts/python/
        0  06-03-2020 12:14   reports/
        0  06-03-2020 12:14   Configurations2/menubar/
        0  06-03-2020 12:14   Configurations2/toolpanel/
        0  06-03-2020 12:14   Configurations2/floater/
        0  06-03-2020 12:14   Configurations2/images/Bitmaps/
        0  06-03-2020 12:14   Configurations2/toolbar/
        0  06-03-2020 12:14   Configurations2/statusbar/
        0  06-03-2020 12:14   Configurations2/accelerator/
        0  06-03-2020 12:14   Configurations2/progressbar/
        0  06-03-2020 12:14   Configurations2/popupmenu/
        0  06-03-2020 12:14   forms/
      884  06-03-2020 12:14   META-INF/manifest.xml
---------                     -------
    71825                     16 files

Solution, remove the empty directory from the ZIP archive.
Downloads 565 $ # Remove Scripts/python directory of ZIP file, if empty
Downloads 566 $ unzip -l "$file" "$pdir/?*" || zip -d "$file" "$pdir/"
Archive:  Konten.odb
  Length      Date    Time    Name
---------  ---------- -----   ----
---------                     -------
        0                     0 files
deleting: Scripts/python/

Then when I open Konten.odb the macro warning no longer appears.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need to remove macro from LO Base and Basic

Post by Villeroy »

Thanks. Once upon a time there used to be a Python macro embedded in that document. After deleting that macro, the empty directory Scripts/python/ remained in the archive. My graphical zip application does not work properly. It does not show the empty Scripts folder. Back to command line where applications are technically mature. My version 6 of unzip is 11 years old. Version 1 was made in 1989.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
widowmaker
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Post by widowmaker »

After deleting the files I mentioned in an earlier post, now when I go to open certain copies of a database, I have some that give me the message “/home////file.odb” “ The document contains document macros.”

When I go to an older version of the same database, I do NOT get any warnings.

I do a backup every night. The first time I received the message claiming there was a micro, has been within the last 5 days, yet I had to go back 30 days to find a file that does not give me the Macro message.

What I am looking for now is the source of the message claiming, ““The document contains document macros.”

I am using LibreOffice Version: 6.0.7.3.

Due to memory problems I do not remember creating the macro, but know I am the one that did it, because it contained my code_id, therefore I am assuming that I made it via the Tools/MyMacros section of LibreOffice Base.
LibreOffice 6.0.7.3 on Linux Mint 19.3
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need to remove macro from LO Base and Basic

Post by Villeroy »

In my database a residual empty Script/python folder was the culprit.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
leoperbo
Posts: 3
Joined: Thu Jun 12, 2008 8:42 pm

Re: [Solved] Need to remove macro from LO Base and Basic

Post by leoperbo »

Just trying to show a summary of the solution:

This is needed to remove macros stored in OpenOffice.org/Libreoffice (application) not in documents.

0) Open a file manager (with search for contents power) and go to ~/.config/*office/#.#/user, where *office stands for openoffice.org or for libreoffice and #.# stands for current version. In my case, it was: ~/.config/libreoffice/7.3.1/user

1) Search for the name of the macro, in my case, MatricLE.

2) Open one of the xml files, like backenddb.xml, search for the name of the macro, take note of the associated path, in my case $UNO_USER_PACKAGES_CACHE/uno_packages/lu80014al9rr.tmp_

3) In the file manager, browse to the noted path and delete the folder, in my case, lu80014al9rr.tmp_.

Image
Libreoffice on Kubuntu 20.04
OpenOffice on Android 10 (AndrOpenOffice)
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: [Solved] Need to remove macro from LO Base and Basic

Post by Villeroy »

leoperbo wrote: Sat Sep 17, 2022 8:36 pm 3) In the file manager, browse to the noted path and delete the folder, in my case, lu80014al9rr.tmp_.
That macro had been installed with an extension. You should remove the extension via Tools>Extension Manager...
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
leoperbo
Posts: 3
Joined: Thu Jun 12, 2008 8:42 pm

Re: [Solved] Need to remove macro from LO Base and Basic

Post by leoperbo »

I wrote the macro in another computer, exported as BASIC and imported on my current computer. No way to remove it via Extension Manager.
Libreoffice on Kubuntu 20.04
OpenOffice on Android 10 (AndrOpenOffice)
Post Reply