View Single Post
 
Old 03-06-2024, 07:09 PM
GarryGS GarryGS is offline Windows 10 Office 2021
Novice
 
Join Date: Mar 2024
Posts: 1
GarryGS is on a distinguished road
Default Word macro to auto add page ranges to a doc index

Hi All:
In an index, Word will only make page ranges instead of individual page numbers (24-28, instead of 24,25,26,27,28) if you use bookmarks. Very tedious, especially with the large index I am producing.


I want to convert the generated index to text (Ctrl shift F9), then run a macro on it to transform, say, "24,25,26,27,28" to "24-28" in each entry. Of course, each entry will have different page numbers to convert.



Has anyone made a macro to do this? I could give it a go, but it is at the limit of my VBA skills. It must involve iterating through the page numbers of each index entry, testing if page number n+1 is one different from page number n, then constructing a suitable string.



Thank you for your time,
Garry
Reply With Quote