Bug 61398 - FILEOPEN: can't get rid of macro warning ('solution' by manualy editing the file's zip container in comment #11)
Summary: FILEOPEN: can't get rid of macro warning ('solution' by manualy editing the f...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
3.5.0 release
Hardware: All All
: high normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:odf, needsDevEval
: 124314 146920 (view as bug list)
Depends on:
Blocks: Macro-VBA
  Show dependency treegraph
 
Reported: 2013-02-24 14:25 UTC by Richard Parkins
Modified: 2023-05-18 14:21 UTC (History)
8 users (show)

See Also:
Crash report or crash signature:


Attachments
Minimal example to provoke bug (34.37 KB, application/vnd.oasis.opendocument.spreadsheet)
2019-01-08 22:52 UTC, Richard Parkins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Parkins 2013-02-24 14:25:26 UTC
I imported an XLS file which contained VBA macros into LibreOffice calc. It can't do VBA macros so I deleted the macros and saved the file as an ODS file. Every time I open the ODS file it warns me that "This document contains macros". I look in Tools->Macros->Organise Macros and there are no macros in the file. Presumably the ODS file still contains some trace of the macros that were in the original XLS file. How do I get rid of the warning? What is the point of warning me about traces that I can't delete of macros that I can't run?
Comment 1 Joel Madero 2013-05-29 21:10:05 UTC
I've noticed this before also - quite annoying. Glad you reported it :)


Marking as:

New
Minor - doesn't prevent high quality work but slows it down and is quite annoying
High - makes users think a macro exists still, anyone who had a macro and deletes it will be affected

ProposedEasyHack


Confirmed on:
4.2 Master built last week
Bodhi Linux x64
Comment 2 Joel Madero 2014-02-27 22:55:30 UTC
In order to limit the confusion between ProposedEasyHack and EasyHack and to make queries much easier we are changing ProposedEasyHack to NeedsDevEval.

Thank you and apologies for the noise
Comment 3 Joel Madero 2015-03-11 17:05:51 UTC
@Richard - I think that this issue has been resolved. Can you verify that this is the case with 4.4.1.2 or newer and mark the bug as RESOLVED -> WORKSFORME?
Comment 4 Robinson Tryon (qubit) 2015-12-13 11:21:06 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2017-01-03 19:47:08 UTC Comment hidden (obsolete)
Comment 6 Dave 2017-10-09 11:12:54 UTC
This bug still exists in version 5.4.2.2.

I have an ODS calc file that I have deleted macros from. I tried renaming .config/libreoffice/4 in case there was a problem in there, but no change.

OS: slackware 14.2 64bit.
LibreOffice: 5.4.2.2
Comment 7 Justin L 2018-01-09 18:59:12 UTC
Just deleting all of the macro code (which to all appearances is the only way to delete this stuff) is not enough to get rid of the macro warning.

However, I just found a way to get rid of the entire VBAMacros library. Go to the Macros Organizer (Tools - Macros - Organize Dialogs), switch to the libraries tab and set the location as your file. Then you can select the VBAMacros library and delete it.

After that, no more prompts.
Comment 8 Richard Parkins 2019-01-08 22:52:08 UTC
Created attachment 148157 [details]
Minimal example to provoke bug
Comment 9 Richard Parkins 2019-01-08 22:55:21 UTC
This is a copy of my file from which I've deleted all the data except for two sheets, which I've renamed as sheet1 and sheet2 and deleted all the content. AS is is, opening it provokes the "has macros" message. Deleting either of the two sheets gets rid of the message
Comment 10 Richard Parkins 2019-01-08 23:03:43 UTC
The bug is still present in LibreOffice Version: 6.1.3.2.

Tools->Macros->Run Macro... doesn't show any macros in the file.
Tools->Macros->Organise Macros->LibreOffice Basic... doesn't show any macros in the file.
Tools->Macros->Organise Macros->JavaScript... doesn't show any macros in the file.
Tools->Macros->Organise Macros->Python... doesn't show any macros in the file.
Tools->Macros->Organise Dialogs... doesn't show any macros in any of its tabs.

I do have a global My Macros file, but this doesn't provoke the error message with any of my other spreadsheets.
Comment 11 Justin L 2019-01-11 18:40:24 UTC
(In reply to Richard Parkins from comment #8)
> Minimal example to provoke bug
The code that identifies the "presence" of the macros is in sfx2/source/doc/docmacromode.cxx.

So, ODS files are just zip files.  I believe that the presence of Basic folder with script files in it triggers the macros.  I was able to unzip the file, delete the Basic folder, and re-zip the file to avoid the macro problem.

I didn't see anywhere in the code that could have accomplished this. One thing to investigate is why the "delete" button cannot delete these things in the modules area.
Comment 12 Justin L 2019-01-11 19:01:13 UTC
When editing the macros, when you double click on "sheet2", it pops up the code tab with Sub Main/End Sub.  Right clicking on the tab gives a delete option, but then the empty code file is just re-created again.
Comment 13 Justin L 2019-01-12 05:09:24 UTC
if I force to module dialog code to enable the delete button (basctl/source/basicide/moduldlg.cxx), it still fails to actually delete the Document Object, so I give up.
Comment 14 Richard Parkins 2019-01-12 18:48:42 UTC
(In reply to Justin L from comment #11)
> (In reply to Richard Parkins from comment #8)
> > Minimal example to provoke bug
> The code that identifies the "presence" of the macros is in
> sfx2/source/doc/docmacromode.cxx.
> 
> So, ODS files are just zip files.  I believe that the presence of Basic
> folder with script files in it triggers the macros.  I was able to unzip the
> file, delete the Basic folder, and re-zip the file to avoid the macro
> problem.
> 
> I didn't see anywhere in the code that could have accomplished this. One
> thing to investigate is why the "delete" button cannot delete these things
> in the modules area.

There are several zip algorithms supported by Linux. In order to replicate the solution that you describe, I need to know which algorithm to use to re-zip the file. I tried zipinfo on the original file, but it doesn't tell me.
Comment 15 Justin L 2019-01-12 18:52:57 UTC
(In reply to Richard Parkins from comment #14)
> I need to know which algorithm to use to re-zip the file.
I just used "zip" from the command line, which is Info-Zip 3.0 in my case.
Comment 16 Richard Parkins 2019-01-12 22:10:42 UTC
(In reply to Justin L from comment #15)
> (In reply to Richard Parkins from comment #14)
> > I need to know which algorithm to use to re-zip the file.
> I just used "zip" from the command line, which is Info-Zip 3.0 in my case.

OK, thanks. That fixes my original file, so it looks as if it a good workaround.

However IMHO the bug (deleting macros not removing the warning) still needs to be fixed.
Comment 17 James 2020-05-20 13:13:51 UTC
looks depending on the - not very well defined? - ole object, embedded and represented by the white square at https://www.wowessays.com/ A14:B20 , 

1. insert row - undo - crash, 

2. F5 - ole objects - object1 - delete 
insert row - undo - no crash, 

2a. click on object - delete (worked not on all attempts) 
insert row - undo - no crash, 

3. undo until ole object present again 
insert row - undo - no crash, 

4. close without save, reload file, 
insert row - undo - crash, 

5. steps 1-3, save file, 
reopen - insert row - undo - crash, 

steps 3. - 4. no 'stable reproducibility', 

played with ver. 6.4.0.1, 6.4.0.2, 7.0.0.0
Comment 18 Leo Moons 2020-05-25 07:27:13 UTC
I escalated the importance to normal as a user will be worried that he has unknown/not found macro in his document.
Comment 19 raal 2022-01-22 18:25:59 UTC
*** Bug 146920 has been marked as a duplicate of this bug. ***
Comment 20 Justin L 2022-09-06 21:05:55 UTC
*** Bug 124314 has been marked as a duplicate of this bug. ***
Comment 21 Justin L 2023-05-18 14:21:55 UTC
For DOCM files, simply saving as DOCX gets rid of macros (in 7.6) thanks to bug 125338.