mbr2012
09-19-2012, 04:54 AM
What I want to know is how to search for numbers in square brackets in a document using VBA and use these as bookmarks to make cross-references to. I'm a newcomer, and I know it has something to do with the inStr function, but not sure how to go about implementing it.
The context is: I am editing a manuscript, and need to make cross-references in my notes to both the page number of the Word document, and the page number in the original text. For example, "p. 3 [MS, p. 7]" would refer to p. 3 in the Word document, and p. 7 on the original manuscript. I want to automate this process using bookmarks and macros. At the moment, I have a document with no bookmarks, which has references to the MS page numbers enclosed in square brackets: for example on p. 3 I have the text "As has been reported [7] her lapse has not intended.". A cross reference to this would be "p. 3 [MS, p. 7]" or, if I can get really clever "p. 3 [MS, pp. 6-7]".
What I want is to be able to search the document for numbers in square brackets, and place bookmarks around these. Then, I can use a macro to insert two cross references to these, one with the word page number and the other with the text in the bookmark, the original manuscript page no.
Cheers.
The context is: I am editing a manuscript, and need to make cross-references in my notes to both the page number of the Word document, and the page number in the original text. For example, "p. 3 [MS, p. 7]" would refer to p. 3 in the Word document, and p. 7 on the original manuscript. I want to automate this process using bookmarks and macros. At the moment, I have a document with no bookmarks, which has references to the MS page numbers enclosed in square brackets: for example on p. 3 I have the text "As has been reported [7] her lapse has not intended.". A cross reference to this would be "p. 3 [MS, p. 7]" or, if I can get really clever "p. 3 [MS, pp. 6-7]".
What I want is to be able to search the document for numbers in square brackets, and place bookmarks around these. Then, I can use a macro to insert two cross references to these, one with the word page number and the other with the text in the bookmark, the original manuscript page no.
Cheers.