Thread: [Solved] Table named after first cell
View Single Post
 
Old 05-15-2019, 06:19 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
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

Well, the solution provided by Macropod does not bookmark the table with the content of the first cell. You are wasting a lot of other people's time by not being clear on what you want.
Code:
Sub Demo()
Dim lngIndex As Long
Dim oTbl As Table
  For lngIndex = 2 To ActiveDocument.Tables.Count
    Set oTbl = ActiveDocument.Tables(lngIndex)
    With oTbl
       .Range.Bookmarks.Add Replace(Split(.Cell(1, 1).Range.Text, vbCr)(0), " ", "_"), .Range
    End With
  Next lngIndex
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote