wdActiveEndAdjustedPageNumber

H

Howard Kaikow

Is this a bug, or a corrupted document?

Say, there are 100 pages in a document, including a few section breaks (all
odd page), then if I use something like the following, I would expect
wdActiveEndAdjustedPageNumber to return a different number for each page
within a section.

previous = 0
For i = 1 to 100
selection.goto what:=wdgotopage, which:=wdgotoabsolute, count:=i
current = selection.information(wdActiveEndAdjustedPageNumber)
if current = previous then
debug.print current, "Duplicate page number in section"
end if
previous = current
next i

Alas, I have a document in which there are 5 cases of duplicate page
numbers. Each is preceded by an odd page section break, but there are many
other odd page section breaks that do not exhibit this behavior.

I have tried using both Range and Selection objects.

Is this a known bug with wdActiveEndAdjustedPageNumber?
I got 0 hits searching for wdActiveEndAdjustedPageNumber in the KB.
Or is this likely just a corrupt document?
 
J

Jonathan West

Hi Howard,

Information(wdActiveEndAdjustedPageNumber) is affected by the page numbering
of the section formatting. On the offending sections, has the page numbering
been modified so that it starts at a specific number instead of continuing
from the previous section?
 
H

Howard Kaikow

I'll check on that ...
I'm back.

All the sections specify continuous numbering from previous section.

--
http://www.standards.com/; See Howard Kaikow's web site.
Jonathan West said:
Hi Howard,

Information(wdActiveEndAdjustedPageNumber) is affected by the page numbering
of the section formatting. On the offending sections, has the page numbering
been modified so that it starts at a specific number instead of continuing
from the previous section?
 
J

Jonathan West

Howard Kaikow said:
I'll check on that ...
I'm back.

All the sections specify continuous numbering from previous section.

Hmmm. Could you check one other thing - whether the Selection.End property
is also duplicated on the duplicate page numbers?
 
H

Howard Kaikow

Jonathan West said:
Hmmm. Could you check one other thing - whether the Selection.End property
is also duplicated on the duplicate page numbers?

Ayup, in all cases, using:

lngPrevious = 0
With Selection
lngPages = .Information(wdNumberOfPagesInDocument)
For i = 2 To lngPages
.GoTo What:=wdGoToPage, Which:=wdGoToAbsolute, Count:=i
lngCurrent = .Information(wdActiveEndAdjustedPageNumber)
If lngCurrent = lngPrevious Then
Debug.Print lngCurrent & "Booboo"
End If
strOutput = "Page " & i & ":" & lngCurrent & ", " & .Start &
", " & .End
lngPrevious = lngCurrent
Debug.Print strOutput
Next i
End With

Output produced is:
Page 2:2, 321, 321
Page 3:3, 1659, 1659
Page 4:4, 6558, 6558
Page 5:5, 11873, 11873
Page 6:6, 17391, 17391
Page 7:1, 23082, 23082
Page 8:2, 25265, 25265
Page 9:3, 26648, 26648
Page 10:4, 29019, 29019
Page 11:5, 29258, 29258
Page 12:7, 29784, 29784
7Booboo
Page 13:7, 29784, 29784
Page 14:8, 31832, 31832
Page 15:9, 33561, 33561
Page 16:10, 35619, 35619
Page 17:11, 37310, 37310
Page 18:12, 38842, 38842
Page 19:13, 40230, 40230
Page 20:14, 42200, 42200
Page 21:15, 44040, 44040
Page 22:16, 46636, 46636
Page 23:17, 48598, 48598
Page 24:18, 50419, 50419
Page 25:19, 52465, 52465
Page 26:20, 54169, 54169
Page 27:21, 56182, 56182
Page 28:23, 57348, 57348
23Booboo
Page 29:23, 57348, 57348
Page 30:24, 58907, 58907
Page 31:25, 60707, 60707
Page 32:27, 61004, 61004
27Booboo
Page 33:27, 61004, 61004
Page 34:28, 63491, 63491
Page 35:29, 65127, 65127
Page 36:30, 67581, 67581
Page 37:31, 69673, 69673
Page 38:32, 71461, 71461
Page 39:33, 73377, 73377
Page 40:34, 75346, 75346
Page 41:35, 77865, 77865
Page 42:36, 80263, 80263
Page 43:37, 81868, 81868
Page 44:38, 84258, 84258
Page 45:39, 86398, 86398
Page 46:40, 88492, 88492
Page 47:41, 90246, 90246
Page 48:42, 92123, 92123
Page 49:43, 94447, 94447
Page 50:44, 96318, 96318
Page 51:45, 98300, 98300
Page 52:46, 100757, 100757
Page 53:47, 100925, 100925
Page 54:48, 103132, 103132
Page 55:49, 104802, 104802
Page 56:50, 107194, 107194
Page 57:51, 108948, 108948
Page 58:52, 110425, 110425
Page 59:53, 112847, 112847
Page 60:54, 114787, 114787
Page 61:55, 117276, 117276
Page 62:56, 119022, 119022
Page 63:57, 121180, 121180
Page 64:58, 123077, 123077
Page 65:59, 125397, 125397
Page 66:60, 127531, 127531
Page 67:61, 128892, 128892
Page 68:63, 130250, 130250
63Booboo
Page 69:63, 130250, 130250
Page 70:64, 132362, 132362
Page 71:65, 134447, 134447
Page 72:66, 136983, 136983
Page 73:67, 138818, 138818
Page 74:69, 139210, 139210
69Booboo
Page 75:69, 139210, 139210
Page 76:71, 139682, 139682
71Booboo
Page 77:71, 139682, 139682
Page 78:72, 141427, 141427
Page 79:73, 142755, 142755
 
H

Howard Kaikow

Figured it out.

In all cases, where the page number was reported as being the same, there is
an odd page section break.
In those cases, the first reported number is actually for the even numbered
page that is being skipped, and the second number is for the actual odd
numbered page that is produced.

This condition is having an adverse effect of a macro I wrote.
I'll check whether testing for an odd page break can circumvent the problem.
If so, then I'd add code for an even page break.
 
J

Jonathan West

Howard Kaikow said:
Figured it out.

In all cases, where the page number was reported as being the same, there is
an odd page section break.
In those cases, the first reported number is actually for the even numbered
page that is being skipped, and the second number is for the actual odd
numbered page that is produced.

That's what I was about to suggest, but you got there ahead of me :)
This condition is having an adverse effect of a macro I wrote.
I'll check whether testing for an odd page break can circumvent the problem.
If so, then I'd add code for an even page break.

What you can do, which would cover skipped pages for either odd or even
section breaks, is record the selection.End property for each jump. if it
the same as for the previous one, then go on to the next page.
 
H

Howard Kaikow

I'd like to be able to detect the type of break, but the Breaks collection
does not seem to offer a means to identify the type of break.
I could then compare to the wdbreaktype constants.
 
J

Jonathan West

Howard Kaikow said:
I'd like to be able to detect the type of break, but the Breaks collection
does not seem to offer a means to identify the type of break.
I could then compare to the wdbreaktype constants.

Check the PageSetup.SectionStart property of each Section.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top