Max Wanadoo
max.wanadoo at gmail.com
Thu Mar 11 18:37:51 CST 2010
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