Robert
robert at servicexp.com
Fri Mar 12 06:24:56 CST 2010
Hey Max, Thanks for the suggestion. However the problem, which I should have been more clear earlier, is not that the bookmark doesn't get found, the problem is this: Even though the myBookmark.Range.HighlightColorIndex property gets set to wdDarkYellow it still does not get highlighted. myBookmark.Range.HighlightColorIndex = 0 Before AND after I set it to wdDarkYellow (14), and I can't figure out why.... WBR Robert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Max Wanadoo Sent: Thursday, March 11, 2010 7:38 PM To: 'Access Developers discussion and problem solving' Subject: Re: [AccessD] MS Word Highlight Problem Robert, I would change the len(mstrbidname) bit to constant 7. You know how long "Bidname" is but you don't know how long len(mstrbidname) is. So it would read: If Left(myBookmark.Name, 7) = "BidName" Then myBookmark.Range.HighlightColorIndex = wdDarkYellow End If Max -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Robert Sent: Thursday, March 11, 2010 11:05 PM To: 'Access Developers discussion and problem solving' Subject: [AccessD] MS Word Highlight Problem Could anyone give me some clues as to why this code does not work? Trying to highlight a text string contained in a bookmark. No errors are thrown, simply doesn't work? For Each myBookmark In objword.ActiveDocument.Bookmarks If Left(myBookmark.Name, Len(mstrBidName)) = "BidName" Then myBookmark.Range.HighlightColorIndex = wdDarkYellow End If Next myBookmark WBR Robert -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com