![]() |
#4
|
||||
|
||||
![]()
As coded, unless your 'Record' bookmarked range includes a terminating paragraph break, the match will fail because the textbox text necessarily includes one. On the assumption that terminating paragraph breaks in both the bookmarked range and the textbox should be excluded from the comparison, you could use:
Code:
Dim shp As Shape, strKeyInfo As String, strText As String, Rng As Range With ActiveDocument Set Rng = .Bookmarks("Record").Range With Rng Do While .Characters.Last = vbCr .End = .End - 1 If .Start = .End Then Exit Do Loop strKeyInfo = .Text End With For Each shp In .Shapes With shp If .Type = msoTextBox Then Set Rng = .TextFrame.TextRange With Rng Do While .Characters.Last = vbCr .End = .End - 1 If .Start = .End Then Exit Do Loop strText = .Text End With If strKeyInfo = strText Then MsgBox "Values Match!" Else MsgBox "Values Do Not Match!" End If End If End With Next End With
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
micko1 | Word VBA | 10 | 11-05-2013 04:42 PM |
![]() |
Amapola188 | Word VBA | 3 | 07-12-2012 05:16 PM |
Repeating Bookmark Text | BECKTHOMO | Word | 1 | 03-27-2012 08:34 PM |
![]() |
skarden | Word | 1 | 12-12-2011 10:39 PM |
![]() |
hklein | Word VBA | 4 | 08-10-2011 04:33 AM |