Bonjour a tous, j'ai une question assez technique concernant le remplacement de texte dans word dans une textbox (textbox est une option de la toolbar "dessin" on peut ecrire dedans et ensuite la deplacer ou on veut dans notre page word.
Je remplace deja du text dans word mais j'arrive pas a remplacer dans la textbox par contre?...
Set doc = objWord.Documents.Add(path_doc & "\" & tab_a_generer(j) & ".doc" )
For i=0 to UBound(tableau)
Execute "tempo=" & tableau(i,2)
With objWord.Selection.Find
.ClearFormatting()
.Text = "@" & tableau(i,0) & "@"
With .Replacement
.ClearFormatting()
.Text = tempo
End With
.Execute , , , , , , , , , , wdReplaceAll
End With
End if
Ceci remplace du text dans ma page word, ca marche tres bien
For Each objShape In objWord.ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).Shapes
For i=0 to UBound(tableau)
Execute "tempo=" & tableau(i,2)
tempo = modiftextdoc(tempo)
Select Case objShape.Type
Next
Case msoTextBox
With objShape.TextFrame.TextRange
.Text = Replace(.Text,"@" & tableau(i,0) & "@", tempo)
End With
End Select
Next
Next
Ceci remplace du texte dans les textbox qui appartiennent a un pied ou entete de page et ca amrche aussi!!!
Mais j'arrive pas a trouver pour les textbox qui sont dans la page meme, j'ai tenter ceci mais ca marche pas
For Each objShape In objWord.ActiveDocument.Shapes
For i=0 to UBound(tableau)
Execute "tempo=" & tableau(i,2)
tempo = modiftextdoc(tempo)
Select Case objShape.Type
Case msoTextBox
With objShape.TextFrame.TextRange
.Text = Replace(.Text,"@" & tableau(i,0) & "@", tempo)
End With
End Select
Next
Next
Voila, si kelkun a une idé eou une question je suis preneur