Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #16  
Old 10-04-2018, 12:24 PM
gmaxey gmaxey is offline Macros from this Forum will not run. Windows 7 32bit Macros from this Forum will not run. Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default


Code:
Sub Delete_Underlines()
'A basic Word macro coded by Graham Mayor,
   'adapted by Greg Maxey, http://gregmaxey.com/word_tips.html, 10/4/2018
Dim oRng As Range
Dim oScope As Range
  Set oRng = Selection.Range
  Set oScope = oRng.Duplicate
  With oRng.Find
    .ClearFormatting
    .Font.Underline = wdUnderlineSingle
    .Replacement.ClearFormatting
    Do While .Execute()
      If oRng.InRange(oScope) Then
      If oRng.Hyperlinks.Count = 0 Then
        oRng.Select
        If MsgBox("Do you want to remove underline from this instance", vbYesNo, "Actio") = vbYes Then
          oRng.Font.Underline = wdUnderlineNone
        End If
        oRng.Collapse 0
      End If
      Else
        Exit Do
      End If
   Loop
  End With
lbl_Exit:
  Set oRng = Nothing
  Set oScope = Nothing
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a sub-Forum for Office for Mac? IvanH Office 1 02-20-2014 11:31 PM
Macros from this Forum will not run. MS Windows forum? Joan64 Office 2 07-01-2013 10:18 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:03 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft