Removing macros

I have a couple of spreadsheets that are distant versions (via “save as…” many times over) of a spreadsheet originally created in MS Excel. When I open the LibreOffice versions, I get a macro warning. Since the spreadsheets don’t use macros, I’d like to get rid of the warning. When I go in to Organize Macros, I can see some structure in there but no actual macros to delete, and the delete key is grayed out as well.
How can I get rid of all this?

1 Like

I would have liked to try your solution of saving the spreadsheet as a .fods (plain text) file, but I can’t see how to do this in the save as dialog other than as a .cvs file - this is the olny save as text option in there in my version of Calc (LibreOffice 3.5.7.2
Build ID: 350m1(Build:2)).

The save option is called OpenDocument Spreadsheet (Flat XML) (.fods). It appears 5th on the list of Save as Type options in my LO 3.5.4.2 and LO 4.0.1.2 (and even in OpenOffice 3.2, but further down on the list).

I don’t know of an easy way to get rid of that irksome Macro warning, but try this (on a copy of your file). Save the spreadsheet as a .fods file (plain text). Open the file with a text editor and locate the section starting with <office:scripts>. Delete the code

<ooo:library-embedded ooo:name="Standard"> 
  [several lines of xml and basic code]
</ooo:library-embedded>

and re-save the file.

2 Likes

STELLAR!!! this solved MY problem too!!! should be made permanent part of the ref guide!!!

I finally got around to trying this method - works great! The spreadsheet was too big for Kate to open (more than 65000 lines!) but it was no problem with vi. There were four or five embedded libraries in there.

thanks man, didn’t know about “flat” formats until now :slight_smile:

Worked for me in Writer too - saved it as a FODT, then edited it with notepad (using the FIND function to assist!).

Interesting though that the “FLAT” file is 150k when original ODT was 39k???

Doesn’t “FLAT” mean “Uncompressed”?

Worked for me too, while the Organiser method did not, as I said in a comment on it.

While playing around with this, I have been able to achieve my desired result by going into Tools|Macros|Organize Dialogs and selecting the libraries tab, then choosing the filename from the location drop down and deleting the library in there (the standard library remains and can’t be deleted). After saving and re-opening the spreadsheet, the macro warning no longer appears.

This worked well for me.
It is a little bit harder to find now, more like:
Tools|Macros|Organize|Libreoffice Basic|Organizer
but it seems to have removed the warning.

One detail I would add: if the file is to be saved back to “xls” format you may need to open it and resave it once in LO first otherwise some Excel versions may look for the non existant macro “file” and crash. After I re-saved it this no longer happened.

This did not work for me: I found and deleted various things with the organiser, but in the end I was stuck with the ¿module? Standard . Document Objects . Sheet1 with nothing to see there but no way in the organiser to remove it. What I did try from there was Edit, which showed me that this ¿module? contained the code:

Rem Attribute VBA_ModuleType=VBADocumentModule
Option VBASupport 1

I removed that code (but still could not delete the object), did Save in the macro editor, closed that, saved, closed and reopened the document, but it still said it contained macros, and the Sheet1 object was still visible in the organiser. It also now and then seemed to add a Main macro to Sheet1.

The method in W_Whalley’s answer worked, and showed that several more places included the above VBA suport stuff.

I’m getting well frustrated playing around with macros trying to create what I want a button to do without knowing a single thing about any of it. I was able to get rid of the module from the list. Can we really not get rid or the entire listing for it? I’m going to end up making a mess of dead macros that are empty and do nothing if we can’t delete them. Just deleting the module of a macro library is like finding our way through a maze. I would agree and support the suggestion of making deleting them entirely, the entire listing, easier. It takes about 5 steps to do now? We should just be able to open the edit window and either select it and delete it or right-click and delete. The way this is is a pain in the butt.