Problem VB/VBA

C

Carl

Hello,

I make a fusion of personal fields into Word, with a vb project.
This code make my search and replace :

Public Sub Remplacer_texte(Texte_à_remplacer As Variant,
Texte_de_remplacement As Variant)
With myWordApplication //
instancié à l'init de la classe
.Selection.Find.ClearFormatting
.Selection.Find.Replacement.ClearFormatting
With .Selection.Find
.Text = Texte_à_remplacer
.Replacement.Text = Texte_de_remplacement
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
.Selection.Find.Execute Replace:=wdReplaceAll
End With
End Sub

It's works great !
But if there is a text area, the text into it is not replaced.

The strange thing, is when i do that directly with Word, Word replace the
texte into text areas too.
I maked a macro to see how Word do that, and the code is exactly the same
with my !!!

If somebody can help me ?

tks
Carl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top