![]() Please remember to put Option Explicit at the top of a code page. The following works for me, as far as the requirements in the question go. here as example is pagenumber.ĮXPECTED RESULT: Within entire document, each sentence has a corresponding bookmark and bookmark name ("bmarkpg01ln01col01", "bmarkpg01ln02col10", etc.)ĪCTUAL RESULTS: only one bookmark is added to the first sentence of the document. Sub tryAddBmarkatSentence()įor Each MySent In ActiveDocument.Sentencesįor Each bmark In ActiveDocument.BookmarksĪ Name:="pmark" & (wdActiveEndAdjustedPageNumber), Range:=myRange 'bmark name would have added info of page, line, and col number. I've tried a for each loop to attempt each sent in sentences and each bmark in bookmark. My code adds only one bookmark to first sentence and doesn't loop through to end of document. For example, at first sentence would be bookmark "bmarkpg01" and second sentence would be bookmark ""bmarkpg01ln01col01"". ![]() ![]() Within a Word docx: I'm trying to add a bookmark to each sentence.
0 Comments
Leave a Reply. |