Thread: [Solved] Table named after first cell
View Single Post
 
Old 05-14-2019, 07:38 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,422
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

If you want to bookmark each table using the text in cell 1 then:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oTbl As Table
Dim oRng As Range
  For Each oTbl In ActiveDocument.Tables
    Set oRng = oTbl.Range
    ActiveDocument.Bookmarks.Add Left(oTbl.Cell(1, 1).Range.Text, Len(oTbl.Cell(1, 1).Range.Text) - 2), oRng
  Next oTbl
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote