>>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)