Micros from this Forum will not run.
Thank you for your prompt reply. I have inserted the MsgBox as advised, but the Message does not appear. Macros are not disabled on my system as far as I can tell. I recall the warning about "dangerous code" being run with that setting. I did not post the Macro because I am struggling with an unfamiliar and complex Forum structure and couldn't see how to do it.
Sub Delete_Underscores()
'
' Delete_Underscores Macro
' Will delete all underscores in Document except in Mail addresses (& hyperlinks ??)
' Author = GMayor.
' This version RETYPED from published Macro because of difficulties with MS Office site.
' CALL with ALT + U (for Underscore)
Dim oRng As range
Dim oWord As range
Set oRng = ActiveDocument.range
With oRng.Find
Do While .Execute(FindText:="_")
Set oWord = oRng.Duplicate
If oWord.Words(1).Start <> ActiveDocument.range.Start Then
oWord.MoveStartUntil Chr(32), wdBackward
oWord.MoveEndUntil Chr(32) & Chr(13)
If InStr(1, oWord.Text, "@") = 0 Then oRng.Text = " "
End If
oRng.Collapse 0
Loop
End With
lbl_Exit:
Set oRng = Nothing
Set oWord = Nothing
Exit Sub
MsgBox "Yes, it ran." 'Added.
End Sub
_________________
No, I'm afraid it didn't run.
Thanks once again.
|