![]() |
#3
|
|||
|
|||
![]()
Bonjour
Je ne sais pas si ce qui suit répond à votre question. Dans un document Word, j'ai placé plusieurs boîtes de texte dont le texte contient une ou plusieurs fois le mot [Name1]. Dans toutes les boites de texte, la macro suivante a remplacé toutes les occurences de ce mot par le mot Mike. (traduction automatique) Hello I don't know if the following answers your question. In a Word document, I placed several text boxes whose text contains one or more times the word [Name1]. In all text boxes, the following macro replaced all occurrences of this word with the word Mike. Code:
Sub test() Dim Sh As Shape For Each Sh In ActiveDocument.Shapes If Sh.Type = msoTextBox Then With Sh.TextFrame.TextRange.Find .ClearFormatting .Replacement.ClearFormatting .Execute FindText:="[Name1]", _ ReplaceWith:="Mike", _ Replace:=wdReplaceAll End With End If Next Sh End Sub Last edited by jpl; 05-22-2022 at 11:41 AM. Reason: Correction de la macro |
Tags |
replace, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA to find text, replace with multiple lines of text | noslenwerd | Word VBA | 3 | 12-31-2019 11:04 AM |
Select all text in multiple text boxes | Virgule | Word | 0 | 06-07-2017 12:11 PM |
![]() |
1Kurgan1 | Word | 2 | 10-31-2016 01:20 AM |
![]() |
RHODIUM | Word | 6 | 10-01-2016 04:43 PM |
Link text of multiple text boxes to one | witchcraftz | PowerPoint | 0 | 08-28-2014 10:29 AM |