Adding symbols before WARNING

V

veronica malt

People, I m looking to add * before the word warning? Wherever warning
appears I want it to be changed as *warning.

Can some help me with this please. I will be so so so glad.

Thank you



Veronica Malt
 
T

Tony Jollans

This doesn't really need a macro, but ..

ActiveDocument.Content.Find.Execute _
FindText:="warning", _
ReplaceWith:="*warning", _
Replace:=wdReplaceAll
 
S

Sahana

This doesn't really need a macro, but ..

ActiveDocument.Content.Find.Execute _
    FindText:="warning", _
    ReplaceWith:="*warning", _
    Replace:=wdReplaceAll

--
Enjoy,
Tony

 www.WordArticles.com









- Show quoted text -

Hello people

I tried that suggested by tony, but the macros continue to check the
same word over again and again. I would like some expert to look over
this and help us out.


The macros I tried was

Sub Macro1()
'
' Macro1 Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "defined"
.Replacement.Text = "*defined"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
MsgBox ("change"), 54
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
End Sub
 
T

Tony Jollans

Your code appears to work for me - but perhaps your requirements are
different from Veronica's.

--
Enjoy,
Tony

www.WordArticles.com

This doesn't really need a macro, but ..

ActiveDocument.Content.Find.Execute _
FindText:="warning", _
ReplaceWith:="*warning", _
Replace:=wdReplaceAll

--
Enjoy,
Tony

www.WordArticles.com









- Show quoted text -

Hello people

I tried that suggested by tony, but the macros continue to check the
same word over again and again. I would like some expert to look over
this and help us out.


The macros I tried was

Sub Macro1()
'
' Macro1 Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "defined"
.Replacement.Text = "*defined"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
MsgBox ("change"), 54
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
End Sub
 
S

Sahana

Your code appears to work for me - but perhaps your requirements are
different from Veronica's.

--
Enjoy,
Tony

 www.WordArticles.com






Hello people

I tried that suggested by tony, but the macros continue to check the
same word over again and again. I would like some expert to look over
this and help us out.

The macros I tried was

Sub Macro1()
'
' Macro1 Macro
'
'
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
        .Text = "defined"
        .Replacement.Text = "*defined"
        .Forward = True
        .Wrap = wdFindContinue
        .Format = False
        .MatchCase = True
        .MatchWholeWord = True
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
    End With
          MsgBox ("change"), 54
    Selection.Find.Execute Replace:=wdReplaceAll
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
   End Sub- Hide quoted text -

- Show quoted text -

Tony can you paste the complete code so that I can test and post
doubts if I have any.
 
T

Tony Jollans

What complete code? I cut and pasted what you posted and it worked.

Or do you mean from my original reply? It is complete - it just needs a
container:

Sub Macro1()
ActiveDocument.Content.Find.Execute _
FindText:="warning", _
ReplaceWith:="*warning", _
Replace:=wdReplaceAll
End Sub

--
Enjoy,
Tony

www.WordArticles.com

Your code appears to work for me - but perhaps your requirements are
different from Veronica's.

--
Enjoy,
Tony

www.WordArticles.com






Hello people

I tried that suggested by tony, but the macros continue to check the
same word over again and again. I would like some expert to look over
this and help us out.

The macros I tried was

Sub Macro1()
'
' Macro1 Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "defined"
.Replacement.Text = "*defined"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = True
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
MsgBox ("change"), 54
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
End Sub- Hide quoted text -

- Show quoted text -

Tony can you paste the complete code so that I can test and post
doubts if I have any.
 
S

Sahana

What complete code? I cut and pasted what you posted and it worked.

Or do you mean from my original reply? It is complete - it just needs a
container:

Sub Macro1()
    ActiveDocument.Content.Find.Execute _
        FindText:="warning", _
        ReplaceWith:="*warning", _
        Replace:=wdReplaceAll
End Sub

--
Enjoy,
Tony

 www.WordArticles.com










Tony can you paste the complete code so that I can test and post
doubts if I have any.- Hide quoted text -

- Show quoted text -

Tony

I run tge macro. Try running it for the second time after running it
for the first time. The end result after second time running is
**warning. This is what I was talking about. Is there any way to avoid
this problem?


Please let me know. It will be so so useful


Sahana
 
T

Tony Jollans

Tony

I run tge macro. Try running it for the second time after running it
for the first time. The end result after second time running is
**warning. This is what I was talking about. Is there any way to avoid
this problem?


Please let me know. It will be so so useful


Sahana

That is a different proposition. It, however, just requires a small
adjustment:

Sub Macro1()
ActiveDocument.Content.Find.Execute _
MatchWildcards:=True, _
FindText:="([!\*])warning", _
ReplaceWith:="\1*warning", _
Replace:=wdReplaceAll
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top