![]() |
|
#1
|
||||
|
||||
![]() You are overcomplicating this. To bookmark the values in Column 3 with the names from Column 4: ....(see also attached) Code:
Sub Mcr_Set_Bookmarks() Dim BKMkName As String Dim BkmkRange As Range Dim oCell As Range Dim rV As Integer For rV = 2 To ActiveDocument.Tables(1).Rows.Count Set oCell = ActiveDocument.Tables(1).Cell(rV, 4).Range oCell.End = oCell.End - 1 'Omit cell end character BKMkName = oCell.Text Set BkmkRange = ActiveDocument.Tables(1).Cell(rV, 3).Range BkmkRange.End = BkmkRange.End - 1 'Omit cell end character 'Add the bookmark to the cell content range ActiveDocument.Bookmarks.Add Range:=BkmkRange, Name:=BKMkName Next rV Set oCell = Nothing Set BkmkRange = Nothing End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How do I code bookmark globally for different template? | Yong Xiang | Word VBA | 17 | 02-06-2019 01:09 PM |
![]() |
Cosmo | Word | 7 | 08-24-2018 01:46 PM |
Bookmark will not show/hide based on CC Checkbox | lord_kaiser | Word VBA | 1 | 04-17-2018 01:19 AM |
![]() |
dfin | Word VBA | 5 | 09-06-2016 10:08 PM |
Find Bookmark, move to bookmark, execute code, repeat | raymm3852 | Word VBA | 10 | 04-15-2016 06:21 PM |