View Single Post
 
Old 03-03-2012, 03:11 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,338
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

You can read from / write to the table as follows:
Code:
Sub Demo()
Dim Rng As Range, BkMk as String
BkMk = "Document_Revision_Table"
With ActiveDocument
  If .Bookmarks.Exists(BkMk) Then
    If .Bookmarks(BkMk).Range.Tables.Count > 0 Then
      With .Bookmarks(BkMk).Range.Tables(1)
        'do something, eg:
        .Cell(1, 1).Range.Text = "Gothca!"
        Set Rng = .Cell(1, 1).Range
        Rng.End = Rng.End - 1
        MsgBox Rng.Text
      End With
    Else
      MsgBox "Missing table"
    End If
  Else
    MsgBox "Missing bookmark: " & BkMk
  End If
End With
End Sub
Note that there's no need to 'goto' or select anything.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]

Last edited by macropod; 03-05-2012 at 04:03 PM. Reason: Code fix & enhancement
Reply With Quote