Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 05-10-2013, 03:02 PM
fumei fumei is offline selecting ms word bookmarks using vba Windows 7 64bit selecting ms word bookmarks using vba Office XP
Expert
 
Join Date: Jan 2013
Posts: 440
fumei is on a distinguished road
Default

Well if all you want to do is action the bookmarks, then just action the bookmarks. There is no need to select anything.

Code:
Sub HighlightBM_InTable()
Dim BM As Bookmark
For Each BM In Selection.Tables(1).Range.Bookmarks
   BM.Range.HighlightColorIndex = wdBlue
Next
End Sub
The code highlights the bookmarks - and only the bookmarks - in the table the selection is in. If you want to do all tables, there is no need to see if the selection is in a table. No selection is made at all.


Code:
Sub HighlightBM_InTable()
Dim BM As Bookmark
Dim oTable As Table
For Each oTable in ActiveDocument.Tables()
  For Each BM In oTable.Range.Bookmarks
    BM.Range.HighlightColorIndex = wdBlue
  Next
Next
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
selecting ms word bookmarks using vba Word vs bookmarks, another instance <g> eNGiNe Word 6 12-05-2012 01:05 AM
selecting ms word bookmarks using vba VBA equivalent to selecting present word KevinJ Word VBA 2 11-05-2012 01:27 PM
selecting ms word bookmarks using vba Autocorrect in Word not selecting proper entry from list Llewella Word 4 05-12-2012 02:22 PM
Word 2007 bookmarks and protection Stevejd58 Word 0 07-31-2011 11:53 AM
word 2007 bookmarks Dawn Word 0 07-14-2009 01:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:39 AM.


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