LibreOffice use macro to remove macro

I got two results from searches on using a macro to remove a macro.

===Use Case===

I want to have a macro run continuously searching for special characters and replacing them. Once the character replacement macro is completed I want the replacement macro to be deleted from the document.

I have initial information for that form to be filled out with that replacement macro. Once that information is filled out I want that macro gone because it will continue to search the next time the document is opened.

===

The two results I got were:

https://forum.openoffice.org/en/forum/viewtopic.php?f=9&t=39313&start=0

Dim oStandard as object

oStandard = GlobalScope.BasicLibraries.getByName("Standard")
if oStandard.hasByName("Module2")  then
  oStandard.removeByName("Module2")
end if

http://mycomputeradventures.foxinnovations.be/2012/01/removing-macros-from.html

Sub RemoveMacros
basicLibraries = ThisComponent.BasicLibraries
standard = basicLibraries.getByName( “Standard” )
standard.removeByName( “Module1” )
End Sub

Another post I’ll create later may have the replacement macro code and explanation