Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 03-03-2012, 03:11 PM
macropod's Avatar
macropod macropod is offline How do I read from a table located with a bookmark Windows 7 64bit How do I read from a table located with a bookmark Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,340
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I read from a table located with a bookmark Auto-numbering non co-located Requirements in a document acheo Word 1 11-24-2011 05:24 PM
Error: The file may be corrupted, located on a server that is not responding, or read naeemeh Excel 2 11-20-2011 03:38 AM
How do I read from a table located with a bookmark VBA to insert Bookmark rockwellsba Word VBA 2 05-31-2011 01:07 AM
Bookmark Classification DrDoom Word 0 06-29-2010 07:08 AM
Bookmark to another document spqr Word 3 06-26-2009 04:51 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:09 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft