Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 07-08-2011, 02:37 AM
macropod's Avatar
macropod macropod is offline Automatically update dates using a macro Windows 7 64bit Automatically update dates using a macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,387
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Matthew,

Try:
Code:
Sub NextYear()
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Text = "[0-9]{1,2}/[0-9]{1,2}/[0-9]{2,4}"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = True
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    .Execute
  End With
  Do While .Find.Found
    If Split(.Text, "/")(2) = Format(.Text, "yyyy") Then
      .Text = DateAdd("yyyy", 1, .Text)
    Else
      .Text = Format(DateAdd("yyyy", 1, .Text), "mm/dd/yy")
    End If
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatically update web images on Powerpoint thetodd14 PowerPoint 0 05-04-2011 10:37 AM
Automatically update dates using a macro How to update automatically the “file name” as we do for the “Date”? Jamal NUMAN Word 2 01-06-2011 02:43 PM
Letter Head Template - Update all other templates automatically nirok Word 1 11-25-2010 03:14 PM
Automatically update dates using a macro How to set links that automatically update tkelly5446 Project 1 11-17-2010 04:26 AM
Automatically update text changes in Word - how do I do it? jonrm Word 2 05-21-2009 08:49 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:05 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