[vba]
Dim novi As Document
Dim novi1 As Document
Dim x As Word.Paragraph
Selection.HomeKey Unit:=wdStory
For Each x In ActiveDocument.Paragraphs
Dim iResponse As Integer
Dim tTable As Table
ActiveDocument.Tables(1).Select
Selection.Collapse Direction:=wdCollapseEnd
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^p"
.Replacement.Text = "^p"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
s1 = Selection.Start
e1 = Selection.End
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
s2 = Selection.Start
e2 = Selection.End
Set myrange = ActiveDocument.Range(Start:=s1, End:=e2)
myrange.Select
Selection.TypeParagraph
Next
End Sub
[/vba]
How can I avoid tables? If table is found then select it and do
[vba]Selection.Collapse Direction:=wdCollapseEnd
[/vba]
I would like macro to preform search in this way:
1. Begin at the top of document
2. Search for paragraphs but if table is found just avoid it and search for next paragraph mark
Or better way would be if paragraph mark is within table then select this table and do:
[vba]Selection.Collapse Direction:=wdCollapseEnd
[/vba]