Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-07-2017, 06:12 PM
gmaxey gmaxey is offline underline  date Windows 7 32bit underline  date 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

You make things harder than they have to be:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey, http://gregmaxey.com/word_tips.html, 7/7/2017
Dim oRng As Range
  Set oRng = ActiveDocument.Range
  With oRng.Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "([0-9]{1,2})[/]([0-9]{1,2})[/]([0-9]{4})"
    .Format = True
    .Forward = True
    .MatchWildcards = True
    While .Execute
      With oRng
        If IsDate(.Text) Then
          .Text = Format(oRng.Text, "dd.mm.yyyy")
          .Font.Underline = True
        End If
        .Collapse wdCollapseEnd
      End With
    Wend
  End With
lbl_Exit:
  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
underline  date Wriggly red underline kirkm Word 3 09-18-2016 07:50 PM
underline  date Hyperlinks: Removing Underline reRanger Word 2 08-04-2016 02:29 AM
underline  date Underline a tab Futsal1st Word 2 10-25-2015 05:31 PM
underline  date Underline at bottom of page won't go away yachts66 Word 3 08-13-2014 07:28 AM
underline  date Hyperlink - delete underline Savana PowerPoint 5 04-13-2011 12:34 AM

Other Forums: Access Forums

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


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