Thread: [Solved] Macro Loop Help
View Single Post
 
Old 09-18-2015, 03:20 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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 Andrew,

As per my last post, the lot could be done with a single wildcard Find/Replace. Here's the macro version:
Code:
Sub CleanupPayslips()
With ActiveDocument.Content.Find
  .ClearFormatting
  .Replacement.ClearFormatting
  .Text = "[^13 ]{7,}(<[0-9]{7}>)"
  .Replacement.Text = "^p^12 \1"
  .Forward = True
  .Wrap = wdFindContinue
  .Format = False
  .MatchWildcards = True
  .Execute Replace:=wdReplaceAll
End With
End Sub
The OP could also have achieved the desired pagination just by changing the page margins...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote