Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Eliminate hyperlinks
Message
From
05/03/2005 14:05:31
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
05/03/2005 12:48:05
General information
Forum:
Microsoft Office
Category:
Word
Miscellaneous
Thread ID:
00992725
Message ID:
00993037
Views:
18
>>But now, I don't know how to ask for user confirmation. Do you happen to know what are the Word VBA commands to do that? I would need to (a) show a confirmation dialog, similar to MessageBox() in VFP, and get a return value for the button pressed, and (b) conditionally interrupit the macro (similar to CANCEL or RETURN in VFP).
>
>I'm out of my element there, but I believe VBA has a MsgBox function. If your environment (macro editor?) has Intellisense, you can probably grok the interface to it by just typing the word and a space.
>
>-- Randy

Great! Yes, the MsgBox does what I want, and the IntelliSense helps a lot.

Here is my Word Macro, for future reference, in case anyone needs it.
Sub DeleteHyperlinks()
'
' This macro will delete all hyperlinks
' in the current document,
' while maintaining the visible text.
    If MsgBox("All hyperlinks in the current document will be deleted. Continue?", vbYesNo, _
     "Delete hyperlinks") = vbYes Then
        Set myDoc = Application.ActiveWindow.Document
        While myDoc.Hyperlinks.Count > 0
            myDoc.Hyperlinks(1).Delete
        Wend
    End If
End Sub
While I still don't know how to break out of a macro (like using RETURN in VFP), I managed to write this one without it.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform