![]() |
|
#4
|
||||
|
||||
|
About the only thing that doesn't work via a Find in tables is when you specify a paragraph break and what you're trying to find has an end-of-cell marker instead - and there's no Find expression for an end-of-cell marker. The code I posted at ExcelForum works just fine with tables otherwise. There are work-arounds for tables; none of them particularly elegant. For example:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim i As Long
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = InputBox("What is the Text to Find")
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute
End With
Do While .Find.Found
If .Characters.Last.Next = vbCr Then
i = i + 1
ElseIf .Information(wdWithInTable) Then
.End = .End + 1
If .Characters.Last = .Cells(1).Range.Characters.Last Then i = i + 1
End If
.Collapse wdCollapseEnd
.Find.Execute
Loop
End With
Application.ScreenUpdating = True
MsgBox i & " instances found."
End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Indentation Not Working Properly
|
LaC0saNostra | Word | 2 | 02-01-2015 11:35 AM |
Freeze Pane isn't working properly
|
ep2002 | Excel | 1 | 07-27-2014 06:53 PM |
| Accent symbols not working properly on new computer | Binary.tobis | Excel | 3 | 04-28-2012 04:49 PM |
[Publisher] Fonts not working properly
|
pajkul | Publisher | 1 | 01-23-2011 07:51 PM |
| Word 2000 Macro not working properly | brianlb | Word VBA | 1 | 07-01-2009 07:04 AM |