Since
@James McLintock went through the work of documenting the code to get the page count, we've gone ahead and updated the official MS Word VBO on the Digital Exchange to include this capability.
You can find the latest MS Word VBO
here.
NOTE: We went ahead and added actions for getting the count of paragraphs, lines, and words in the document too.
Cheers,
------------------------------
Eric Wilson
Director, Integrations and Enablement
Blue Prism Digital Exchange
------------------------------
Original Message:
Sent: 06-14-2022 12:04
From: James McLintock
Subject: Get Number of pages from a Word document
Hi Erjola,
You can do this in a couple of steps:
- Import, or ensure you have, the MS Word VBO from the Program Files
- Create a new version of this VBO called "MS Word VBO - Extended" - to align with our best practices
- Create a new action called "Count Document Pages" with the following detail:
- Inputs: [handle] and [documentName]
- Process Flow: Start > Call CheckInstanceHandle Page > Code Stage > End
- Code Stage
- 'Declare object for code use
Dim doc as Object = GetDocument(handle,documentName)
'Returns the number of pages in the document associated with the range (whole document).
result = doc.Range.Information(4)
- Outputs: Result
This will allow you to count the number of pages, if you need any more actions let me know
All the best,
James
------------------------------
James McLintock Program Lead
Intelligent Automation, Program Lead
Blue Prism
Europe/London
Original Message:
Sent: 06-14-2022 11:24
From: Erjola Mema
Subject: Get Number of pages from a Word document
Hi everyone!
Hope you are doing okay!
I have a question:
How can I get the number of pages into a WORD document?
Thank you for your time!
Erjola
------------------------------
Erjola Mema
------------------------------