Thread: [Solved] Table named after first cell
View Single Post
 
Old 05-15-2019, 12:39 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Simpler:
Code:
Sub Demo()
Dim Tbl As Table
For Each Tbl In ActiveDocument.Tables
  With Tbl
    .Range.Bookmarks.Add Split(.Cell(1, 1).Range.Text, vbCr)(0), .Range
  End With
Next Tbl
End Sub
As with Greg's code, though, if the content of the first paragraph in the first cell isn't valid for a bookmark, you'll get an error.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote