#1
|
|||
|
|||
Find and list Blank pages in Word document.
Hi! I need to write macro to find all blank pages and create list of them at the end of the document or in new document. Could anybody help me? |
#2
|
||||
|
||||
Why does your document have blank pages? How are they generated (e.g. via Odd/Even Next page Section breaks, or by some other method)?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
These documents have thousands of Tables and Figures. Tables and Figures are separated by Section Breaks. Sometimes only Section break appears on the page, and that creates blank page in document.
Yes, Blank pages are generated by 'Next page Section breaks'. However they are not on odd\even page always. Interval of blank pages is not fixed. Last edited by ndandge; 11-27-2015 at 02:09 AM. |
#4
|
||||
|
||||
Try:
Code:
Sub Demo() Dim i As Long, Rng As Range, StrPages As String With ActiveDocument For i = 1 To .ComputeStatistics(wdStatisticPages) Set Rng = .GoTo(What:=wdGoToPage, Name:=i) Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\page") If Len(Rng) < 3 Then StrPages = StrPages & " " & Rng.Information(wdActiveEndAdjustedPageNumber) Next End With StrPages = Replace(Trim(StrPages), " ", ", ") MsgBox "The following pages are empty:" & vbCr & StrPages End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Thank you so much!
It worked. Its really helping me. Thanks once again. |
Tags |
word 2007, word vba macro |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
can word: make variables, find appropriate pages, fill out pages with variables, print only those | 20GT | Word VBA | 1 | 10-15-2014 09:48 PM |
Removing blank pages at the end of a document | Xanzia | Word | 3 | 06-01-2014 11:13 AM |
Word and other word processors print blank pages | jrasicmark | Word | 5 | 05-28-2014 03:10 PM |
Unable to retain section page numbering while removing the blank pages in MS word 201 | ramsgarla | Word | 3 | 10-01-2012 03:52 AM |
delete blank pages from mail merge document | blusea | Word | 0 | 12-17-2010 06:10 PM |