Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #9  
Old 01-05-2017, 02:04 AM
macropod's Avatar
macropod macropod is offline page breaks Insertion Windows 7 64bit page breaks Insertion Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,514
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

The following macro inserts prefixes every page with <pg> and ends it with </pg>
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument
  For i = .ComputeStatistics(wdStatisticPages) To 2 Step -1
    .GoTo(What:=wdGoToPage, Name:=i).InsertBefore "</pg><pg>"
  Next
  .Range.InsertBefore "<pg>"
  .Range.InsertAfter "</pg>"
End With
Application.ScreenUpdating = True
End Sub
Note that the code works backwards through the document, so that its own additions don't disturb the locations of the original page breaks.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
page breaks Insertion Configured page size to 20 inches height : why the page still breaks @ the default 9,6” ? Ron Wolpa Word 4 08-18-2016 06:43 PM
Subdocuments without Page Breaks? titani2 Word 8 08-26-2014 05:58 AM
page breaks Insertion Hidden page breaks and section breaks jrasicmark Word 3 06-02-2014 11:28 PM
page breaks Insertion Page breaks and page numbering sfteam Word 3 06-06-2013 11:56 PM
Deleted Section Breaks Changes Page Breaks Brantnshellie Word 0 02-01-2009 09:22 PM

Other Forums: Access Forums

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