Thread: [Solved] Table named after first cell
View Single Post
 
Old 05-15-2019, 05:47 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

bookmarks can't have spaces in them. You can try:

Code:
Sub Demo()
Dim Tbl As Table
For Each Tbl In ActiveDocument.Tables
  With Tbl
     .Range.Bookmarks.Add Replace(Split(.Cell(1, 1).Range.Text, vbCr)(0), " ", "_"), .Range
  End With
Next Tbl
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote