Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Retrieving page number count from Word DOC
Try the old way:
Dim PageCount as long pagecount=ExecuteExcel4Macro("GET.DOCUMENT(50)") NickHK "Garbunkel" wrote in message ... Hi all, I am working with an Excel VB script (V6.3) to extract data from a set of Microsoft Word DOC files. I need to use a VB solution to retrieve the page number count (the actual number of pages that would be printed if I hit the 'Print' button) from a Microsoft Word DOC file. I tried the following way: Dim ActiveWB As Workbook Set ActiveWB = ActiveWorkbook ActiveWB.Worksheets(1).DisplayAutomaticPageBreaks = True HorizBreaks = ActiveWB.Worksheets(1).HPageBreaks.Count HPages = HorizBreaks + 1 VertBreaks = ActiveWB.Worksheets(1).VPageBreaks.Count VPages = VertBreaks + 1 NumPages = HPages * VPages ActiveWB.Worksheets(1).DisplayAutomaticPageBreaks = False ActiveWB.Worksheets(1).Cells(1, 1).Value = NumPages ...but it always comes back with a '2' Any assistance I can get on this would be greatly appreciated. - Michael |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I lighten the word "Page" (and number) in Page Break View? | Excel Discussion (Misc queries) | |||
Counting the number of times a word appears 'anywhere' on a page | New Users to Excel | |||
count number of occurances of a word in a range | Excel Worksheet Functions | |||
Open Microsoft Word and get Page count. | Excel Programming | |||
determine page number in Word document | Excel Programming |