L
Laura
I have to program a macro that inserts an asteristic in a specific point of
the line, if the first character of a sentences is a ‘D’ folllowed by a *.
So, I find first .Text = "^pD*", and then I have to move the cursor until
the second asteristic, and put another *, and repeat this for all the
paragraphs (that begins by D*)
Example:
Initial:
A*A*PLANOS
D*CCM-PLIG-001-00V*INTERCONEXIÓN GENERAL (SIRUACIÓN FINAL), ED CECOM ST
CTA[2ª-CHA-CM=F-ECL]*51
D*CCM-PLVF-001-00V*V*ISTA FRONTAL-BATERÃA RACKS (SIRUACIÓN FINAL), ED CECOM
ST CTA[2ª-CHA-CM=F-ECL]*61
End:
A*A*PLANOS
D*CCM-PLIG-001-00V*INTERCONEXIÓN GENERAL (SIRUACIÓN FINAL), ED CECOM ST
CTA[2ª-CHA-CM=F-ECL]*5*1
D*CCM-PLVF-001-00V*V*ISTA FRONTAL-BATERÃA RACKS (SIRUACIÓN FINAL), ED CECOM
ST CTA[2ª-CHA-CM=F-ECL]*5*1
Below is my code, but doesn’t work correctly. Can you help me please?
With Selection.Find
.Text = "^pD*"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.Execute
Do While .Found
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find
.Text = "*"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.Execute
.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:="*"
End With
Loop
End With
the line, if the first character of a sentences is a ‘D’ folllowed by a *.
So, I find first .Text = "^pD*", and then I have to move the cursor until
the second asteristic, and put another *, and repeat this for all the
paragraphs (that begins by D*)
Example:
Initial:
A*A*PLANOS
D*CCM-PLIG-001-00V*INTERCONEXIÓN GENERAL (SIRUACIÓN FINAL), ED CECOM ST
CTA[2ª-CHA-CM=F-ECL]*51
D*CCM-PLVF-001-00V*V*ISTA FRONTAL-BATERÃA RACKS (SIRUACIÓN FINAL), ED CECOM
ST CTA[2ª-CHA-CM=F-ECL]*61
End:
A*A*PLANOS
D*CCM-PLIG-001-00V*INTERCONEXIÓN GENERAL (SIRUACIÓN FINAL), ED CECOM ST
CTA[2ª-CHA-CM=F-ECL]*5*1
D*CCM-PLVF-001-00V*V*ISTA FRONTAL-BATERÃA RACKS (SIRUACIÓN FINAL), ED CECOM
ST CTA[2ª-CHA-CM=F-ECL]*5*1
Below is my code, but doesn’t work correctly. Can you help me please?
With Selection.Find
.Text = "^pD*"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.Execute
Do While .Found
Selection.MoveRight Unit:=wdCharacter, Count:=1
Selection.Find
.Text = "*"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.Execute
.Execute
Selection.MoveRight Unit:=wdCharacter, Count:=2
Selection.TypeText Text:="*"
End With
Loop
End With