From: Gordon Bentley-Mix on 19 May 2010 21:16 Word 2003 Windows Vista Business I'm trying to determine programmatically the number of pages in one document for use in another document. I've worked out that: NumberOfPagesInOtherDoc = OtherDoc.ActiveWindow.Panes(1).Pages.Count gets me what I want, and it is probably robust enough for my current needs. However, I'm wondering if there isn't a more efficient way. I recognise that the concept of "the number of pages in a document" is a somewhat fluid thing - influenced by stuff like the printer driver, etc. - but I somehow expected there to be a more direct method for finding this information. It appears that the Pages collection (and the related Count property) can only be accessed through the Pane object. This seems a bit... clunky. Any other suggestions? -- Cheers! Gordon Bentley-Mix
From: Doug Robbins - Word MVP on 19 May 2010 21:33 NumberofPages = [DocumentObject].BuiltInDocumentProperties(wdPropertyPages) NumberofPages = [DocumentObject].Range.Information(wdActiveEndPageNumber) and there may be more. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Gordon Bentley-Mix" <gordon(a)NOSPAM.exmvps.org> wrote in message news:578055F7-D373-46E8-9272-88F714EE60DF(a)microsoft.com... > Word 2003 > Windows Vista Business > > I'm trying to determine programmatically the number of pages in one > document for use in another document. I've worked out that: > > NumberOfPagesInOtherDoc = OtherDoc.ActiveWindow.Panes(1).Pages.Count > > gets me what I want, and it is probably robust enough for my current > needs. However, I'm wondering if there isn't a more efficient way. > > I recognise that the concept of "the number of pages in a document" is a > somewhat fluid thing - influenced by stuff like the printer driver, etc. - > but I somehow expected there to be a more direct method for finding this > information. It appears that the Pages collection (and the related Count > property) can only be accessed through the Pane object. This seems a > bit... clunky. Any other suggestions? > -- > Cheers! > > Gordon Bentley-Mix
From: Gordon Bentley-Mix on 19 May 2010 21:53 Thanks Doug! I knew I could count on you to come up with something more elegant than tapping into the Panes collection. ;-P I reckon I'll probably use the first one, since it's something I'm at least a bit familiar with. I suppose that will return a String. I need to do some arithmetical operations with NumberOfPagesInOtherDoc (and I've declared it as Integer in order to do so), so probably best if I convert the value to the proper data type along the way. But first I think I'll have some lunch... -- Cheers! Gordon Bentley-Mix Also originally posted via msnews.microsoft.com "Doug Robbins - Word MVP" <dkr(a)REMOVECAPSmvps.org> wrote in message news:3D53D942-BF1D-4F68-832B-A802EC4E625F(a)microsoft.com... > > NumberofPages = > [DocumentObject].BuiltInDocumentProperties(wdPropertyPages) > > NumberofPages = [DocumentObject].Range.Information(wdActiveEndPageNumber) > > and there may be more. > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "Gordon Bentley-Mix" <gordon(a)NOSPAM.exmvps.org> wrote in message > news:578055F7-D373-46E8-9272-88F714EE60DF(a)microsoft.com... >> Word 2003 >> Windows Vista Business >> >> I'm trying to determine programmatically the number of pages in one >> document for use in another document. I've worked out that: >> >> NumberOfPagesInOtherDoc = OtherDoc.ActiveWindow.Panes(1).Pages.Count >> >> gets me what I want, and it is probably robust enough for my current >> needs. However, I'm wondering if there isn't a more efficient way. >> >> I recognise that the concept of "the number of pages in a document" is a >> somewhat fluid thing - influenced by stuff like the printer driver, >> etc. - but I somehow expected there to be a more direct method for >> finding this information. It appears that the Pages collection (and the >> related Count property) can only be accessed through the Pane object. >> This seems a bit... clunky. Any other suggestions? >> -- >> Cheers! >> >> Gordon Bentley-Mix >
|
Pages: 1 Prev: Obus Forme Backrest Next: Word 2007 bug: unexpected ContentControlOnExit event is fired |