![]() |
|
#1
|
|||
|
|||
|
I need a simple macro to search * in a word file.
I tried with registration macro, but the results was an empy macro. I want only that the macro, by pressing the f2 key, position the cursor in the first next * the file, without any sostitution. Then I manually replace * with the word I want digit How can I do? thanks in advance for the help |
|
#2
|
||||
|
||||
|
You don't need a macro to do this. CTRL+H put * in the find box and select Find Next. If you desperately need a macro for some reason then use the macro recorder to record the search.
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#3
|
|||
|
|||
|
thanks for the attention
But: ctrl+h doesn't open the find box (in my office) the macro recorder doesn't write the search This what appears after registration: Sub Macro1() ' ' Macro1 Macro ' cerca asterisco ' CommandBars("Navigation").Visible = False End Sub |
|
#4
|
||||
|
||||
|
If Ctrl-H doesn't open Word's Find/Replace dialogue, that could only be because you've modified your system. Furthermore, whatever it is you're recording, the code you posted has nothing to do with Find/Replace.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#5
|
|||
|
|||
|
I have yet installed office in the new pc
I have not changed anything in the old pc I have recorded the macro but i can't recover that I know that the code I posted has nothing to do with find menù, but that's my result trying Do you have something else? |
|
#6
|
||||
|
||||
|
It is difficult to understand why the built-in command (CTRL+H) is not working but check the shortcut key assignments - http://www.gmayor.com/installing_macro.htm
If you record the macro, it should give you: Code:
Sub Macro1()
'
' Macro1 Macro
'
'
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "*"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
#7
|
|||
|
|||
|
thank you a lot.
it works. |
|
#8
|
|||
|
|||
|
the find box in my office open with
ctrl+shift+T but your macro is more useful because it permit me to work automatically |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Macro to search for specific words in a document
|
mike0215 | Word VBA | 2 | 11-28-2017 07:25 AM |
| Writing a Macro which will search for the content of a cell rather than it's value | Sears36 | Excel Programming | 1 | 05-11-2017 07:55 AM |
| Macro on Search and Replace | davidhuy | Word VBA | 1 | 12-19-2014 04:47 AM |
Macro help - search for value, paste a value in another column
|
IRollman | Excel Programming | 1 | 01-14-2014 01:05 PM |
Word Macro to search all tables
|
silverspr | Word VBA | 3 | 04-02-2011 11:20 PM |