J
JayCharms
The following loop (used to tighten up pagraphs, since I need an
accurate first character later in the process) gets stuck as soon as
the style condition ("if parchk.style=..."is met.
Dim par as paragraph
Dim parchk as range
Dim newtext as string
Dim oldstyle as style
For Each par In ActiveDocument.Paragraphs
Set parchk = par.Range
If parchk.Style = "BNormal" Or parchk.Style = "Summary" Or
parchk.Style = "bucknormal" Then
Set oldstyle = parchk.Style
newtext = Trim(parchk.Text)
par.Range.Text = newtext
par.Range.Style = oldstyle
End If
Next
If I replace the "For each..." with "For x=1 to
activedocument.paragraphs.count", setting
parchk=ActiveDocument.paragraphs(x), the loop processes all the
paragraphs but the style ends up incorrect. Taking out
par.range.style=oldstyle also doesn't work. Any ideas would be
appreciated.
accurate first character later in the process) gets stuck as soon as
the style condition ("if parchk.style=..."is met.
Dim par as paragraph
Dim parchk as range
Dim newtext as string
Dim oldstyle as style
For Each par In ActiveDocument.Paragraphs
Set parchk = par.Range
If parchk.Style = "BNormal" Or parchk.Style = "Summary" Or
parchk.Style = "bucknormal" Then
Set oldstyle = parchk.Style
newtext = Trim(parchk.Text)
par.Range.Text = newtext
par.Range.Style = oldstyle
End If
Next
If I replace the "For each..." with "For x=1 to
activedocument.paragraphs.count", setting
parchk=ActiveDocument.paragraphs(x), the loop processes all the
paragraphs but the style ends up incorrect. Taking out
par.range.style=oldstyle also doesn't work. Any ideas would be
appreciated.