Link to home
Create AccountLog in
Avatar of bogorman
bogorman

asked on

Creating "Remove Hyperlinks" Macro in Open Office

I am running OO using a MacBook Pro OSX 10.6.5
I have this macro which runs well in Word (Windows XP):

Sub RemoveHyperlinks()
'
'
' RemoveHyperlinks Macro
' Macro created 04/10/2008 by Brian O'Gorman
'
Dim i As Long
For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
ActiveDocument.Hyperlinks(i).Delete
Next i


End Sub

It does not appear to run in OO on the Mac.
I find OO quite confusing when it comes to creating macros. If I go to Tools/Macros/Organize Macros/OpenOffice.org Basic, under MyMacros Standard I have Module1. Under existing macros in Module1 I have RemoveHyperlinks listed.

If I click on Edit I have entered the following:

Sub RemoveHyperlinks()
'
'
' RemoveHyperlinks Macro
' Macro created 04/10/2008 by Brian O'Gorman
'
Dim i As Long
For i = ActiveDocument.Hyperlinks.Count To 1 Step -1
ActiveDocument.Hyperlinks(i).Delete
Next i


End Sub

However, if I then open the document with the hyperlinks in it and then select Tools/Macros/Organize Macros/OpenOffice.org Basic, the RemoveHyperlinks macro is displayed under Macro Name, and then select Run I get a Basic Runtime Error - Object Variable not set when the cursor is on the line

For i....

Can anyone suggest a solution?

ASKER CERTIFIED SOLUTION
Avatar of FirstSentinel
FirstSentinel
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of bogorman
bogorman

ASKER

Hi,
Sorry for delay in responding.
Your macro works perfectly. The only thing I can't understand with OO is that the macro is saved in OpenOffice.org Basic Macros/My Macros/Standard/Module 1. I would like to save it as Remove Hyperlinks. How do I do that?