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

Creating a macro - Writing a Script - Using the API

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

Postby widowmaker » Wed Jun 03, 2020 12:54 am

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
widowmaker
 
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Postby Zizi64 » Wed Jun 03, 2020 6:29 am

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; LO6.1.6, 6.2.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-6.4.5;AOO4.1.7
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.
User avatar
Zizi64
Volunteer
 
Posts: 9544
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Need to remove macro from LO Base and Basic

Postby JeJe » Wed Jun 03, 2020 10:58 am

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?
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1152
Joined: Wed Mar 09, 2016 2:40 pm

Re: Need to remove macro from LO Base and Basic

Postby Villeroy » Wed Jun 03, 2020 2:18 pm

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 33 times
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28551
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need to remove macro from LO Base and Basic

Postby widowmaker » Wed Jun 03, 2020 3:18 pm

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
widowmaker
 
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Postby JeJe » Wed Jun 03, 2020 3:40 pm

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   Expand viewCollapse view
sub yoursubname()
end sub


You can also comment out a macro so nothing runs with ' in front of every line

Code: Select all   Expand viewCollapse view
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   Expand viewCollapse view
sub yoursubname()
Exit sub
'nothing else will run
end sub
Openoffice 4.1.6
Windows 8
JeJe
Volunteer
 
Posts: 1152
Joined: Wed Mar 09, 2016 2:40 pm

Re: Need to remove macro from LO Base and Basic

Postby widowmaker » Wed Jun 03, 2020 5:39 pm

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   Expand viewCollapse view
sub yoursubname()
end sub


You can also comment out a macro so nothing runs with ' in front of every line

Code: Select all   Expand viewCollapse view
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   Expand viewCollapse view
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

Postby widowmaker » Wed Jun 03, 2020 5:45 pm

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
widowmaker
 
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Postby RoryOF » Wed Jun 03, 2020 5:46 pm

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.7 on Xubuntu 20.04.1 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 31436
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Need to remove macro from LO Base and Basic

Postby Villeroy » Wed Jun 03, 2020 6:28 pm

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
Bildschirmfoto von 2020-06-03 18-20-33.png
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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28551
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need to remove macro from LO Base and Basic

Postby widowmaker » Wed Jun 03, 2020 6:50 pm

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
widowmaker
 
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Postby Villeroy » Wed Jun 03, 2020 6:58 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28551
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need to remove macro from LO Base and Basic

Postby MrProgrammer » Wed Jun 03, 2020 7:27 pm

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 on MacOS 10.14.6.   The locale for any menus or Calc formulas in my posts is English (USA).
User avatar
MrProgrammer
Moderator
 
Posts: 3964
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Need to remove macro from LO Base and Basic

Postby Villeroy » Wed Jun 03, 2020 8:56 pm

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28551
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Need to remove macro from LO Base and Basic

Postby widowmaker » Wed Jun 03, 2020 9:50 pm

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
widowmaker
 
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Need to remove macro from LO Base and Basic

Postby Villeroy » Thu Jun 04, 2020 10:37 am

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, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28551
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 3 guests