You are currently viewing the Word VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I'm after a VBA code to automatically bookmark each cell in a table with a prefix and the relevant row number, so that:
prefix = Alpha
row1 = "alpha"&"1"
row2 = "alpha"&"2"
Sub Bkmk_Tables()
Dim oTable As Table
Dim i1 As Integer
If ActiveDocument.Tables.Count = 0 Then Exit Sub
Set oTable = ActiveDocument.Tables(1)
For i1 = 1 To oTable.Rows.Count
ActiveDocument.Bookmarks.Add "Alpha" & i1, oTable.Rows(i1)
Next i1
End Sub