![]() |
#1
|
|||
|
|||
![]()
My macro chooses a number of extracts from a large document, each extract is 30 words long. It writes them on a second document. All this works fine.
I now want to add a bookmark at the start of each extract. I have taken an example from the microsoft library so that the relevant parts of the code are Code:
For n = 1 to 10 ' Number of extracts bkmk="bm" & n z=Rnd mx=(upperbound - lowerbound +1)*Rnd + lowerbound m=Int(mx) sorsDoc.Words(m).Bookmarks.Add Name:="bkmk" 'The above from https://msdn.microsoft.com/en-us/library/office/ff197253.aspx [Some other instructions] next 'Next n |
#2
|
||||
|
||||
![]()
You are creating a bookmark named "bkmk" instead of creating a bookmark named bm#
Get rid of the quote marks on the line that should read Code:
sorsDoc.Words(m).Bookmarks.Add Name:=bkmk
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Find Bookmark, move to bookmark, execute code, repeat | raymm3852 | Word VBA | 10 | 04-15-2016 06:21 PM |
Userform without inserting Bookmark text | mktate | Word VBA | 8 | 12-31-2015 01:11 PM |
![]() |
newbieX | Word VBA | 6 | 11-20-2015 02:03 PM |
![]() |
RegAudit | Word | 6 | 03-16-2015 11:08 PM |
vba to go to next bookmark | megatronixs | Word VBA | 2 | 06-08-2014 09:53 PM |