LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I lighten the word "Page" (and number) in Page Break View? ExcelJockey Excel Discussion (Misc queries) 0 June 29th 06 07:26 PM
Counting the number of times a word appears 'anywhere' on a page Brother Laz New Users to Excel 1 June 17th 06 03:06 PM
count number of occurances of a word in a range John Davies Excel Worksheet Functions 3 February 24th 06 01:46 PM
Open Microsoft Word and get Page count. Joe[_18_] Excel Programming 0 July 15th 03 08:14 PM
determine page number in Word document Cath Victor Excel Programming 0 July 13th 03 08:39 AM


All times are GMT +1. The time now is 08:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"