#1
|
||||
|
||||
Get page number from object
Hi
I have a macro that loops through the text boxes in a multi-page word document and shrinks the text if it's overflowing: Code:
For Each oShp In ActiveDocument.Shapes If oShp.Type = msoTextBox Then Do While ActiveDocument.Shapes(oShp.Name).TextFrame.Overflowing ActiveDocument.Shapes(oShp.Name).TextFrame.TextRange.Font.Shrink Loop End if Next Thanks! |
#2
|
||||
|
||||
Try something based on:
Code:
Sub Demo() Dim SBar As Boolean, oShp As Shape, i As Long, j As Long With Application .ScreenUpdating = False SBar = .DisplayStatusBar .DisplayStatusBar = True End With For Each oShp In ActiveDocument.Shapes With oShp i = .Anchor.Information(wdActiveEndPageNumber) If i <> j Then StatusBar = "Processing page: " & i j = i End If If .Type = msoTextBox Then Do While .TextFrame.Overflowing .TextFrame.TextRange.Font.Shrink Loop End If End With Next With Application .StatusBar = False .DisplayStatusBar = SBar .ScreenUpdating = True End With End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
||||
|
||||
wow - comprehensive reply!
I'll give it a go - thanks. UPDATE - Yep, works a treat! - cheers |
Tags |
page number |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Running Head AND Page Number on First Page of Document (for APA Format) with Word 2003 | DBinSJ | Word | 3 | 11-23-2016 11:52 AM |
Page number begins at 1 when I page a page landscape | oliboi | Word | 2 | 02-01-2016 06:09 AM |
Start page number on page 3, go to page not working properly | MetroBOS | Word | 7 | 01-30-2016 11:31 PM |
Object in header or cover page? | bemrick | Word | 5 | 02-18-2015 02:59 PM |
Page number with chapter number but not from Heading 1 | alpruett | Word | 5 | 06-04-2014 02:00 PM |