H
Hari Prasadh
Hi,
I have a document running to 800 pages or so, which has been produced by
another software (WinCross - A CROSS-TABULATION Software) and its output was
saved in *.Rtf format. The another software itself generates
a) Table of contents --TOC
b) Actual Write-up after TOC
c) page numbers - on top and bottom of each page in b) (The first page
after TOC would have -- Page 1 -- on top right and bottom middle of each
page and the subsequent pages would have increasing page numbers)
Basically, the other software makes a), b) and c) as MAIN STORY. That is
page numbers which are there on each page after Table of contents are part
of the Main Story itself.
Due to some bug in Wincross we are producing outputs in batches and then
copy pasting them. That is b) is copied from each individual batch and
pasted one below the other to produce a consolidated/ global b). Due to copy
paste page numbers were wrong in the Global/Consolidated b). I got a macro
from H Weber recently which could realign the page numbers in b). Basically
this was a Find/replace text, where the text to find was -- .Text = "Page
[0-9]{1,2}" -- and text to replace was -- .Replacement.Text = "Page " &
lTmp - 30 , where lTmp is the real word page number. We are using the number
30 here because table of contents was for 30 pages.
Now, I seek a macro for correcting the page numbers which are displayed
WITHIN the TOCs.
Since, after running H Weber's macro, b) would be perfectly alright, so I
want page numbers within TOC to be displaying same page numbers as the
respective page numbers in b).
Im pasting part of the first Page of TOC.
Page 1.......TABLE 1-A
SCREENER
Page 45.......TABLE 1-B
QUOTA GROUPS
Page 64.......TABLE 1-C
REFORMULATED COMBINED QUOTA GROUPS
Page 73.......TABLE 1
COMBINED QUOTA GROUPS
So,What I want is to put a for loop which would search starting from first
Real page of word till the end of TOC. Then within each page of TOC it
searches for the string -- .text = "Page [0-9]{1,2,3}....." -- And then the
cursor goes to end of that and then reads the text of the remaining
sentence. Like in the above case -- Page 64.....-- would be searched and the
text of the remaining sentence would be -- TABLE 1-C --. Now, I want to
perform a search on text -- Table 1-C -- within b) part which is the part of
document after TOC. The Real word page number of the first instance of the
text would be copied and then it would replace -- Page 64.....-- with ---
Page ?? - 30 -- where ?? is the real page number where -- Table 1-C -- was
found within b).
Im doing - 30 in above case because I have taken an example where TOC is 30
pages. if it is different I will go and change that line of code to some
other number.
Please guide me if possible.
Thanks a lot,
Hari
India
I have a document running to 800 pages or so, which has been produced by
another software (WinCross - A CROSS-TABULATION Software) and its output was
saved in *.Rtf format. The another software itself generates
a) Table of contents --TOC
b) Actual Write-up after TOC
c) page numbers - on top and bottom of each page in b) (The first page
after TOC would have -- Page 1 -- on top right and bottom middle of each
page and the subsequent pages would have increasing page numbers)
Basically, the other software makes a), b) and c) as MAIN STORY. That is
page numbers which are there on each page after Table of contents are part
of the Main Story itself.
Due to some bug in Wincross we are producing outputs in batches and then
copy pasting them. That is b) is copied from each individual batch and
pasted one below the other to produce a consolidated/ global b). Due to copy
paste page numbers were wrong in the Global/Consolidated b). I got a macro
from H Weber recently which could realign the page numbers in b). Basically
this was a Find/replace text, where the text to find was -- .Text = "Page
[0-9]{1,2}" -- and text to replace was -- .Replacement.Text = "Page " &
lTmp - 30 , where lTmp is the real word page number. We are using the number
30 here because table of contents was for 30 pages.
Now, I seek a macro for correcting the page numbers which are displayed
WITHIN the TOCs.
Since, after running H Weber's macro, b) would be perfectly alright, so I
want page numbers within TOC to be displaying same page numbers as the
respective page numbers in b).
Im pasting part of the first Page of TOC.
Page 1.......TABLE 1-A
SCREENER
Page 45.......TABLE 1-B
QUOTA GROUPS
Page 64.......TABLE 1-C
REFORMULATED COMBINED QUOTA GROUPS
Page 73.......TABLE 1
COMBINED QUOTA GROUPS
So,What I want is to put a for loop which would search starting from first
Real page of word till the end of TOC. Then within each page of TOC it
searches for the string -- .text = "Page [0-9]{1,2,3}....." -- And then the
cursor goes to end of that and then reads the text of the remaining
sentence. Like in the above case -- Page 64.....-- would be searched and the
text of the remaining sentence would be -- TABLE 1-C --. Now, I want to
perform a search on text -- Table 1-C -- within b) part which is the part of
document after TOC. The Real word page number of the first instance of the
text would be copied and then it would replace -- Page 64.....-- with ---
Page ?? - 30 -- where ?? is the real page number where -- Table 1-C -- was
found within b).
Im doing - 30 in above case because I have taken an example where TOC is 30
pages. if it is different I will go and change that line of code to some
other number.
Please guide me if possible.
Thanks a lot,
Hari
India