#31
|
||||
|
||||
If you did as I suggested in post #17, you wouldn't need to check the document as you could be assured the header would reflect the cover page.
And yes, you can save a Style. I'd have thought that was perfectly obvious as the attachment to post #17 has two such Styles being used for this. Simply add them to your exam document's template.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#32
|
||||
|
||||
Are you trying to automate the marking of exam papers OR trying to identify problems in exam papers you are creating?
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#33
|
|||
|
|||
Hi, Guessed
When the teachers created the exam paper, sometime there will be errors like incorrect total marks, missing pages or questions. Thus when we open the document using the program that I am doing in UiPath, the program will automate the workflow and check if the exam paper has any errors. The errors identified will be written in a text file. |
#34
|
|||
|
|||
Hi, macropod
Thank you, I will try it out and get back to you. Thank you |
#35
|
||||
|
||||
Getting the headers isn't going to tell you any of those things. It won't even tell you if there are missing pages because, except for your first page, all pages will have the same header.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#36
|
|||
|
|||
Well, I solved that task (To get header text from each/selected page) in simple way (it works in my case):
Code:
Function GetPageHeader(MyCurrentPage As Integer) As String Set sel = Selection.GoTo(What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=mCPage) GetPageHeader = ActiveDocument.Range.GoTo(What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=MyCurrentPage).Sections(1).Headers(wdHeaderFooterPrimary).Range.Text End Function Well, we may have problems with section amount or correct number, but you can just loop it. Selection.GoTo - helps in cases where you keep getting wrong (general) header. |
#37
|
||||
|
||||
There are far easier ways to do what your code does, but it doesn't do what you think it does - all it does is get the primary header for the current Section (not the current page header). What your code clearly doesn't do is retrieve what might be a 'first page' or 'even page' header when that's what might be displayed for the selected page.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Apply template with headers/footers to an existing Word document Files | qadeerahmed | Word | 5 | 05-08-2017 05:28 AM |
Headers & Footers - Show Document Text | Aprilann | Word | 6 | 04-13-2017 09:34 AM |
Word 2007 - different text for odd and even headers? | JQP | Word | 4 | 10-09-2011 06:49 PM |
How do I have headers and footers appear as regular text for the whole document? | user908045 | Word | 0 | 03-13-2010 12:41 PM |
Portrait & Landscape Headers in Same Word Document | Coast331 | Word | 0 | 10-24-2009 02:39 PM |