Problème rayage de texte VBA
Boosterz
Messages postés
109
Statut
Membre
-
Argitxu Messages postés 5291 Statut Contributeur -
Argitxu Messages postés 5291 Statut Contributeur -
Bonjour,
Je cherche comment faire pour résoudre un soucis sur Word en VBA :
- J'ai une page Y de mon document qui est répété X fois suivant la valeur d'une comboBox ( 1 à 4 )
- Sur ses différentes pages il y a des noms de ville et suivant quelle est la ville sélectionné et le numéro de site qui est adapté à la page je voudrais que les autres soit rayé voici le code que j'ai fais mais qui ne fonctionne pas.
Je sais que je me suis fais chier il y avait plus simple mais je ne voulais pas me prendre la tête... Enfin si quelqu'un à une solution je prend.
Merci
Je cherche comment faire pour résoudre un soucis sur Word en VBA :
- J'ai une page Y de mon document qui est répété X fois suivant la valeur d'une comboBox ( 1 à 4 )
- Sur ses différentes pages il y a des noms de ville et suivant quelle est la ville sélectionné et le numéro de site qui est adapté à la page je voudrais que les autres soit rayé voici le code que j'ai fais mais qui ne fonctionne pas.
Dim LigneD As Integer Dim LigneF As Integer Set doc = ActiveDocument Set myRange = ActiveDocument.Range(Start:=LigneD, End:=LigneF) If (ComboBox1.Value = "1") Then LigneD = 4000 ElseIf (ComboBox1.Value = "2") Then LigneD = 6000 ElseIf (ComboBox1.Value = "3") Then LigneD = 9000 ElseIf (ComboBox1.Value = "4") Then LigneD = 12000 End If LigneF = LigneD + 1000 If (ComboBoxNDs.Value = "VILLE4") Then Set doc = ActiveDocument Set myRange = ActiveDocument.Range(Start:=LigneD, End:=LigneF) myRange.find.Execute FindText:="VILLE1", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If myRange.find.Execute FindText:="VILLE2", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If myRange.find.Execute FindText:="VILLE3", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If ElseIf (ComboBoxNDs.Text = "VILLE2") Then myRange.find.Execute FindText:="VILLE4", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If myRange.find.Execute FindText:="VILLE1", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If myRange.find.Execute FindText:="VILLE3", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If ElseIf (ComboBoxNDs.Text = "VILLE1") Then myRange.find.Execute FindText:="VILLE4", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If myRange.find.Execute FindText:="VILLE2", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If myRange.find.Execute FindText:="VILLE3", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If ElseIf (ComboBoxNDs.Text = "VILLE3") Then myRange.find.Execute FindText:="VILLE4", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If myRange.find.Execute FindText:="VILLE2", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If myRange.find.Execute FindText:="VILLE1", Forward:=True If myRange.find.Found = True Then myRange.Font.StrikeThrough = True End If End If
Je sais que je me suis fais chier il y avait plus simple mais je ne voulais pas me prendre la tête... Enfin si quelqu'un à une solution je prend.
Merci
A voir également:
- Problème rayage de texte VBA
- Texte de chanson gratuit pdf - Télécharger - Vie quotidienne
- Transcription audio en texte word gratuit - Guide
- Excel cellule couleur si condition texte - Guide
- Traitement de texte gratuit - Guide
- Texte de barra - Guide
1 réponse
Bonjour
Je ne pourrai te répondre car je suis nulle en macro.
Mais si tu veux une solution, pose ta question ici sur la faqword
http://faqword.com/forums/
Il y a des macroteurs word ;-))
Je ne pourrai te répondre car je suis nulle en macro.
Mais si tu veux une solution, pose ta question ici sur la faqword
http://faqword.com/forums/
Il y a des macroteurs word ;-))