![]() |
#6
|
||||
|
||||
![]() Quote:
Code:
Sub Demo() Application.ScreenUpdating = False Dim StrOut As String With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Font.ColorIndex = wdBlue .Text = "" .Replacement.Text = "" .Format = True .Forward = True .Wrap = wdFindStop .Execute End With Do While .Find.Found StrOut = StrOut & vbCr & .Text If .Information(wdWithInTable) = True Then If .End = .Cells(1).Range.End - 1 Then .End = .Cells(1).Range.End .Collapse wdCollapseEnd If .Information(wdAtEndOfRowMarker) = True Then .End = .End + 1 End If End If End If If .End = ActiveDocument.Range.End Then Exit Do .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True If StrOut = "" Then StrOut = "Nothing" MsgBox "Found: " & StrOut End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Detecting that previous character doesn't exist (i.e., present character is first in document) | Robert K S | Word VBA | 15 | 08-01-2016 09:33 AM |
![]() |
RickLegrand | Word | 7 | 07-23-2015 06:35 PM |
![]() |
mohsen.amiri | Word | 2 | 02-19-2015 11:38 PM |
![]() |
ronksmith | Word | 1 | 05-19-2012 10:35 AM |
![]() |
pstein | Word | 1 | 03-26-2012 03:01 PM |