If I remember correctly, the IDE-view won't be updated. You can call routines of the deleted module?
Call the caller of sub DeleteDocModule (params) without IDE. Then start the IDE and you should not find the module._________________Rest in peace, oooforum.org
Get help on https://forum.openoffice.org

Your call removes the module from disk. What happens if you close the IDE and then open the IDE again? It should show that the module is gone.

I demonstrate an advanced technique where I am actively adding and removing modules in my AndrewBase document on my web site (if you wanted to see an example). If you want to see it, read the section titled "Dynamically call object methods". I create library modules and then call routines that I create. I use this to inspect objects by calling methods._________________--
Andrew Pitonyak
http://www.pitonyak.org/oo.php

Thank you for your help, but the problem still exists. The deleted module can not be found after it has been removed, but even if I close all OOo application windows and reopen the Writer-file or restart the computer, again the deleted module appears. I can not call a routine in this document because the code is running from outside the document in "My macros & dialogs".

What I want to achieve, more precisely said, is to remove a module named "Main" in the "Standard" lib of an opened 1.1.4 sxw-file, that has a button to start an export process. This button and its macro is not needed anymore because the export in the upcoming version is invoked via an Addon-Menu. In order to "upgrade" existing documents to the new version, the button and the module that have become obsolete should be deleted. As a positive effect the file can then be opened without macro-warning.

That changes things a bit. I would need to check my book, but I think that you can NOT manipulate a library or module in a document that is not current (meaning it is not the same as "ThisComponent")._________________--
Andrew Pitonyak
http://www.pitonyak.org/oo.php

As far as I know, it is not possible to call a routine that is placed in a document from within a GlobalScope-Library, even if the called routine is placed the actual document (ThisComponent).

Just if I did not explain it well: It IS a module of the active document (ThisComponent) that should be deleted. The calling routine however is placed in a GlobalScope lib. It would be nice, Andrew, if you could take a look at your documents. I will also try to find a solution in the meantime.

As far as I know, it is not possible to call a routine that is placed in a document from within a GlobalScope-Library, even if the called routine is placed the actual document (ThisComponent).

This is wrong. I added a new section to my free macro document that demonstrates EXACTLY how to do this. A technique that is not even in the German translation of my book...

[/quote]It IS a module of the active document (ThisComponent) that should be deleted. The calling routine however is placed in a GlobalScope lib. It would be nice, Andrew, if you could take a look at your documents. I will also try to find a solution in the meantime.
/quote]

I tried some code such as that shown below, but the empty module was still there...

Since the Standard lib is not responsable for the macro-warning, I would be happy enough to realize the removing of just a module (I called it "Main"). There might also be other user defined modules that I do not want to touch. But in case this is the only module, the document will be free of macro code when I get the removing of the module to work.

So when I check the macros with the macro organizer after having removed a module this way, the module is still existant, but there are no more routines listed in that module. Closing and reopening the document however will reanimate the module and all its routines.

I will now try to find a way to make the changes permanent. As a workaround one could internally open a new document, transfering the complete document into that new one (except the macros ;-), closing the actual doc and overwrite it with the new document ... hm.

Removing the testLib, removes all modules of testLib rather than the library itself.
Additionally this won't change the modified state of the document, so you can close it without beeing prompted for saving.
The second line sets the modified state to true._________________Rest in peace, oooforum.org
Get help on https://forum.openoffice.org

Additionally this won't change the modified state of the document, so you can close it without beeing prompted for saving.

I was not aware of that...

I saved the document before running the first line and stumbled across the disabled floppy-button on the main toolbar._________________Rest in peace, oooforum.org
Get help on https://forum.openoffice.org

Thank you Andrew and Villeroy for beeing engaged in this matter. I also realized that the modified state is not set, so I manually inserted a space and saved the document. Unfortunately the problem remains. I can't get the module removed.

These are the steps I have done successfully:
Create new doc of any kind.
Insert module in it's "Standard" container (code below)
Insert new library (default name "Library1")
Insert some new modules in "Library1".
Save the document.
Run documentContainer.Standard.Main

Code:

Sub Main
THisComponent.BasicLibraries.removeLibrary("Library1")
thisComponent.store
End Sub

Thank you Villeroy. After some further unsuccessful tries in removing a named module, I now delete the complete library of the document as you proposed (after an appropriate warning and a user-confirmation):

Code:

oLibs = ThisComponent.getLibraryContainer()
if oLibs.hasByName("Standard") then
'trying to remove a module by use of getLibraryContainer object unsuccessful
'so remove the complete library via BasicLibraries
thisComponent.BasicLibraries.removeLibrary("Standard")
thisComponent.setModified(true)
end if

It is not the solution I prefer, because it will also remove other user-defined modules that might exist in the document - even this is a very unlikely case.