L
Laura
once i asked in this forum, how could I select the text between 2 marks, The
marks were the first asteristic and the paragraph mark
I wrote an example;
with this text:
P*1.1*Antecedentes*Hasta la fecha actual*
x*a1* este es el anexo primero**17
A*a1* este es el apendice primero
and with the macro that Helmut Weber provided me, I was able to extract, for
example, this text: "1.1*Antecedentes*Hasta la fecha actual*"
I remembered the macro:
--------------------------------------------------
Sub Macro7()
Dim rTMp As Range
Set rTMp = selection.Paragraphs(1).Range
If rTMp.Characters(1) = "x" Then
rTMp.start = rTMp.start + 1
rTMp.End = rTMp.End - 1
rTMp.Select
' which is redundant
' for retrieving the text
MsgBox rTMp
Else
Exit Sub
End If
End Sub
--------------------------------------
it was ok, but now I need that the macro be more general. For example ->the
text between 2 asteristic.
i know to do it with the firs part (that only has a word), but when it has
more than a word, i don't know how to do it.
dim uno as string
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "*"
.Replacement.Text = " * "
End With
Selection.Find.Execute Replace:=wdReplaceOne
uno = ActiveDocument.Paragraphs(3).Range.Words(2)
Can you help me please?thanks!
marks were the first asteristic and the paragraph mark
I wrote an example;
with this text:
P*1.1*Antecedentes*Hasta la fecha actual*
x*a1* este es el anexo primero**17
A*a1* este es el apendice primero
and with the macro that Helmut Weber provided me, I was able to extract, for
example, this text: "1.1*Antecedentes*Hasta la fecha actual*"
I remembered the macro:
--------------------------------------------------
Sub Macro7()
Dim rTMp As Range
Set rTMp = selection.Paragraphs(1).Range
If rTMp.Characters(1) = "x" Then
rTMp.start = rTMp.start + 1
rTMp.End = rTMp.End - 1
rTMp.Select
' which is redundant
' for retrieving the text
MsgBox rTMp
Else
Exit Sub
End If
End Sub
--------------------------------------
it was ok, but now I need that the macro be more general. For example ->the
text between 2 asteristic.
i know to do it with the firs part (that only has a word), but when it has
more than a word, i don't know how to do it.
dim uno as string
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "*"
.Replacement.Text = " * "
End With
Selection.Find.Execute Replace:=wdReplaceOne
uno = ActiveDocument.Paragraphs(3).Range.Words(2)
Can you help me please?thanks!