N
NWx
Hi,
I have a word DOC and I have to automatically replace some text in it with other.
The code uses Automation from an Access application to handle the Word DOC
Somewhere on a page of the Doc I have a text like this
Categorie A1
Dinsdag 25-01-2005 aanvang 19.00 De Boeg 2
&
Woensdag 26-01-2005 aanvang 19.00 De Welvaart 1
I have the following VBA code to find that part of the doc and populate the table
.....
cSearchName = "Categorie[ ]@" & rsCat!CatNaam & rsCat!PouleNaam
Set myfind = oWrdDoc.Content.Find
myfind.MatchWildcards = True
myfind.Execute FindText:=cSearchName, Forward:=True
If myfind.Found Then
Set myrange = oWrdDoc.Range(myfind.Parent.Start, End:=oWrdDoc.Range.End)
Set tbl = myrange.Tables(1)
......
And now I know how to populate the table using
.....
Set rng = tbl.Cell(i, j).Range
rng.Text = MyValue
However, I don't know how to change the
Dinsdag 25-01-2005 aanvang 19.00 De Boeg 2
and
Woensdag 26-01-2005 aanvang 19.00 De Welvaart 1
The idea is I don't know what text I have to look for, but instead I have to replace the text on second and 4'th rows AFTER Categorie A1 (title). And on any of those rows, there are two variables who hold the value to replace with, one for normal text and one for bold.
As you see, I have to format also the values, to use Times Roman 14 normal for the beginning and bold for De Boeg 2
Can anyone give me a clue on how to do it?
Thank you
Regards,
Tomas
I have a word DOC and I have to automatically replace some text in it with other.
The code uses Automation from an Access application to handle the Word DOC
Somewhere on a page of the Doc I have a text like this
Categorie A1
Dinsdag 25-01-2005 aanvang 19.00 De Boeg 2
&
Woensdag 26-01-2005 aanvang 19.00 De Welvaart 1
I have the following VBA code to find that part of the doc and populate the table
.....
cSearchName = "Categorie[ ]@" & rsCat!CatNaam & rsCat!PouleNaam
Set myfind = oWrdDoc.Content.Find
myfind.MatchWildcards = True
myfind.Execute FindText:=cSearchName, Forward:=True
If myfind.Found Then
Set myrange = oWrdDoc.Range(myfind.Parent.Start, End:=oWrdDoc.Range.End)
Set tbl = myrange.Tables(1)
......
And now I know how to populate the table using
.....
Set rng = tbl.Cell(i, j).Range
rng.Text = MyValue
However, I don't know how to change the
Dinsdag 25-01-2005 aanvang 19.00 De Boeg 2
and
Woensdag 26-01-2005 aanvang 19.00 De Welvaart 1
The idea is I don't know what text I have to look for, but instead I have to replace the text on second and 4'th rows AFTER Categorie A1 (title). And on any of those rows, there are two variables who hold the value to replace with, one for normal text and one for bold.
As you see, I have to format also the values, to use Times Roman 14 normal for the beginning and bold for De Boeg 2
Can anyone give me a clue on how to do it?
Thank you
Regards,
Tomas