Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-10-2013, 02:08 PM
dnc dnc is offline selecting ms word bookmarks using vba Windows 7 32bit selecting ms word bookmarks using vba Office 2007
Novice
selecting ms word bookmarks using vba
 
Join Date: May 2013
Posts: 2
dnc is on a distinguished road
Default selecting ms word bookmarks using vba


I'm using for each loops to search thru some word tables to find enclosing bookmarks. There are several rows and several cells per row. Several cells have enclosing bookmarks, in the cell. As I loop thru the cells in a row I use a for each loop to look for bookmarks in the cell. I would expect each cell to "see" only it's bookmarks but all of the bookmarks in the row are selected one after the other. So if there are six cells in a row and only two cells have one bookmark each, I see each bookmark selected six times not once as I would expect.

Code:
For Each wRow In wTbl.Rows
  For Each wCell In wRow.Cells
    wCell.Select
    wApp.Selection.Range.Collapse wdCollapseStart
      For Each wBmk In wApp.Selection.Bookmarks
      wBmk.Range.HighlightColorIndex = wdBlue
      Sleep 150
      wBmk.Range.HighlightColorIndex = wdNoHighlight
      Sleep 150
    Next
  Next
Next
The highlighting is only for testing. How do I get only the cells with bookmarks and only the bookmark in that particular cell.

Last edited by macropod; 05-10-2013 at 04:02 PM. Reason: Added code tags & formatting
Reply With Quote
 



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 01:24 PM.


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