[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libreoffice-users] Remove Macro from spreadsheet


On 04/08/2012 07:02 PM, drew jensen wrote:
On Sun, 2012-04-08 at 13:06 +0100, Gordon Burgess-Parker wrote:
LO 3.5.2.2.
I tried setting a Macro in a particular spreadsheet that didn't work.
I have deleted everything I can find in Tools-Macros-Organise
Macros-Libre Office Basic but there are still two entries of Standard
under My Macros and the name of the spreadsheet that have no Delete
option when selected.
Every time the sheet opens I get a message about either allowing or
disabling Macros.
How do I delete this macro completely so there is no message on opening
the sheet?
The items are modules.

Open the Organize macors dialog again
Select the Module tab
Hightlight and delete each module
close the dialog
Save the file

Now the library 'Standard' is still part of the document, but with zero
modules the security message will not trigger.

best wishes,

//drew

Some time back (about six months), I posted this:

Sub RemoveAllContainedLibs
Dim sNames
Dim oLibs
Dim i%

oLibs = ThisComponent.BasicLibraries
sNames = oLibs.getElementNames()
For i = UBound(sNames) To LBound(sNames) Step -1
oLibs.removeLibrary(sNames(i))
Next
oLibs = ThisComponent.DialogLibraries
sNames = oLibs.getElementNames()
For i = UBound(sNames) To LBound(sNames) Step -1
oLibs.removeLibrary(sNames(i))
Next
End Sub

Drew decided to one-up me with this better version... And this is one reason that I love open source :-)


Sub RemoveAllContainedLibs
Dim sNames
Dim oLibs
Dim i%
Dim EmptyEventProps(1) as new com.sun.star.beans.PropertyValue

oLibs = ThisComponent.BasicLibraries
sNames = oLibs.getElementNames()
For i = UBound(sNames) To LBound(sNames) Step -1
oLibs.removeLibrary(sNames(i))
Next
oLibs = ThisComponent.DialogLibraries
sNames = oLibs.getElementNames()
For i = UBound(sNames) To LBound(sNames) Step -1
oLibs.removeLibrary(sNames(i))
Next
'
' clear all document event handlers
For i = UBound(ThisComponent.Events.elementNames) To LBound(ThisComponent.Events.elementNames) Step -1
ThisComponent.Events.ReplaceByName(ThisComponent.Events.ElementNames(i), EmptyEventProps())
next
'
' force dirty flag on document
ThisComponent.setModified(True)

End Sub


Might help, might not.

--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
Info: http://www.pitonyak.org/oo.php


--
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted

References:
[libreoffice-users] Remove Macro from spreadsheetGordon Burgess-Parker <gbplinux@gmail.com>
Re: [libreoffice-users] Remove Macro from spreadsheetdrew jensen <drewjensen.inbox@gmail.com>
Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the GNU Lesser General Public License (LGPLv3). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.