J
James Pannozzi
I have built some tables by converting
tab delimited text files to table.
After each convert to table, I insert a pagebreak with
MyRange.InsertBreak wdPageBreak
thus starting each new table on a new page.
I tried iterating across the several tables
and keep getting "required element not found in collection"
(see code below)
but when I have just one table the text bolding works fine.
Is there a way to search and remove
these pagebreaks so that the
several tables all become 1 table
so that I can search for some text
and boldface rows containing it easily without tripping over mixed up ranges
or whatever the hell it is that is giving me that message.
After that I would just re-insert the pagebreaks
thus restoring the paging.
Here is code I am using to do the boldfacing
after the tables are being built:
For T = 1 to objWord.ActiveDocument.Tables.Count
'Boldface the row whoose first column has the text "Special Fee"
With objWord.Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.MatchWildcards = True
.Text = "Special Fee" 'find and boldface all rows with
occurences of this text
Do While .Execute
Set oRng =
objWord.ActiveDocument.Range(objWord.Selection.Range.Start,objWord.Selection
..Range.End)
objWord.ActiveDocument.Tables(T).Rows(oRng.Information(wdEndOfRangeRowNumber
)).Range.Font.Bold = True
Loop
End With
End With
Next
After doing the boldfacing I'd like to
restore the pagebreaks.
tab delimited text files to table.
After each convert to table, I insert a pagebreak with
MyRange.InsertBreak wdPageBreak
thus starting each new table on a new page.
I tried iterating across the several tables
and keep getting "required element not found in collection"
(see code below)
but when I have just one table the text bolding works fine.
Is there a way to search and remove
these pagebreaks so that the
several tables all become 1 table
so that I can search for some text
and boldface rows containing it easily without tripping over mixed up ranges
or whatever the hell it is that is giving me that message.
After that I would just re-insert the pagebreaks
thus restoring the paging.
Here is code I am using to do the boldfacing
after the tables are being built:
For T = 1 to objWord.ActiveDocument.Tables.Count
'Boldface the row whoose first column has the text "Special Fee"
With objWord.Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.MatchWildcards = True
.Text = "Special Fee" 'find and boldface all rows with
occurences of this text
Do While .Execute
Set oRng =
objWord.ActiveDocument.Range(objWord.Selection.Range.Start,objWord.Selection
..Range.End)
objWord.ActiveDocument.Tables(T).Rows(oRng.Information(wdEndOfRangeRowNumber
)).Range.Font.Bold = True
Loop
End With
End With
Next
After doing the boldfacing I'd like to
restore the pagebreaks.