Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Sub Add_Table_Bookmarks() Dim tbl As Table Dim b As Integer Dim rng As Range Dim Bookmark1 As Variant Dim Bookmark2 As Variant If MsgBox("Would you like to create bookmarks in certain cells of all the tables?" & vbCrLf & vbCrLf & _ "These bookmarks form the basis for TOC items!" & vbCrLf & _ "Normally the MOH-Codes and Set Descriptions are the ones to be bookmarked", vbYesNo + vbQuestion, "Create bookmarks in table!") = vbNo Then Exit Sub End If Bookmark1 = InputBox("Please indicate the first cell to be bookmarked!", "first cell to be bookmarked") If Bookmark1 = "" Then Exit Sub Bookmark2 = InputBox("Please indicate the second to be bookmarked!", "second cell to be bookmarked") If Bookmark2 = "" Then Exit Sub b = 1 With ActiveDocument For Each tbl In .Tables ' new requirement: the macro should only run on table 5, 13, 19, 23, 27, 44, 54, 73 Set rng = tbl.Cell(2, Bookmark1).Range 'first cell rng.MoveEnd wdCharacter, -1 .Bookmarks.Add ("bookmark_" & b), rng Set rng = tbl.Cell(2, Bookmark2).Range 'fourth cell rng.MoveEnd wdCharacter, -1 .Bookmarks.Add ("bookmark_" & b + 1), rng b = b + 2 Next tbl End With End Sub
Join the community of 500,000 technology professionals and ask your questions.