nachtschicht
06-30-2009, 09:06 AM
Hi!
I have to merge a couple of table in a word document (an application is returning one table per dataset rather than one additional row... :doh:). As there are several tables in the document which should not be touched by the macro I have added a string in front of the break (which is after every table):
(I cannot post links yet - please find the image at: security-blog.eu/wp-content/uploads/2009/06/table.png or attached)
From my understanding I should now be able to merge the tables by simply deleting the string ###FIND_ME### as well as the wrapping breaks using this function:
Sub merge_tables()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p###FIND_ME###^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
... but it doesn't work that way :(
It works partly if I just replace the string ^p###FIND_ME###.
Any suggestions how I could get this function working?
Thanks!
I have to merge a couple of table in a word document (an application is returning one table per dataset rather than one additional row... :doh:). As there are several tables in the document which should not be touched by the macro I have added a string in front of the break (which is after every table):
(I cannot post links yet - please find the image at: security-blog.eu/wp-content/uploads/2009/06/table.png or attached)
From my understanding I should now be able to merge the tables by simply deleting the string ###FIND_ME### as well as the wrapping breaks using this function:
Sub merge_tables()
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "^p###FIND_ME###^p"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
... but it doesn't work that way :(
It works partly if I just replace the string ^p###FIND_ME###.
Any suggestions how I could get this function working?
Thanks!