Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Macro recorder not recording properly
Word 2003. I do a wildcard Find Highlight all then copy, ctrlHome,paste,
it works great. But when I try to macro record this sequence it does not work. The debug on the Copy statement says nothing is selected. And the macro only has Find, not Find All. How do I fix this? |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Macro recorder not recording properly
I'm afraid it can't be fixed. The macro recorder has limited capabilities. At
best, you can use it to get an understanding of which objects you need to look in to when you want to perform a certain task in VBA. Recorded macros must always (or almost always!) be edited if they should be truly useful. -- Stefan Blom Microsoft Word MVP (Message posted via news.eternal-september.org) "Al Almoian" wrote in message 3... Word 2003. I do a wildcard Find Highlight all then copy, ctrlHome,paste, it works great. But when I try to macro record this sequence it does not work. The debug on the Copy statement says nothing is selected. And the macro only has Find, not Find All. How do I fix this? |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Macro recorder not recording properly
For more on this subject, see
http://word.mvps.org/FAQs/MacrosVBA/...ordedMacro.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Stefan Blom" wrote in message ... I'm afraid it can't be fixed. The macro recorder has limited capabilities. At best, you can use it to get an understanding of which objects you need to look in to when you want to perform a certain task in VBA. Recorded macros must always (or almost always!) be edited if they should be truly useful. -- Stefan Blom Microsoft Word MVP (Message posted via news.eternal-september.org) "Al Almoian" wrote in message 3... Word 2003. I do a wildcard Find Highlight all then copy, ctrlHome,paste, it works great. But when I try to macro record this sequence it does not work. The debug on the Copy statement says nothing is selected. And the macro only has Find, not Find All. How do I fix this? |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Macro recorder not recording properly
The macro recorder, as others have suggested, cannot cope with this type of
action. You would need to create a roll-your-own function that would process each found item separately. It seems that you want to insert all the found items at the start of your document. The following macro will do that, with each item separated by a comma and a space: Dim oRng As Range Dim sText As String Dim sFound As String sFound = "" sText = InputBox("Enter the string to process") Selection.HomeKey wdStory Selection.Find.ClearFormatting With Selection.Find Do While .Execute(findText:=sText, _ MatchWildcards:=True, _ Wrap:=wdFindStop, Forward:=True) = True Set oRng = Selection.Range sFound = sFound & oRng.Text & ", " Loop End With If Len(sFound) 0 Then sFound = Left(sFound, Len(sFound) - 2) ActiveDocument.Range.InsertBefore sFound & vbCr Else MsgBox "Item not found", vbInformation, "Find text" End If http://www.gmayor.com/installing_macro.htm "Al Almoian" wrote in message 3... Word 2003. I do a wildcard Find Highlight all then copy, ctrlHome,paste, it works great. But when I try to macro record this sequence it does not work. The debug on the Copy statement says nothing is selected. And the macro only has Find, not Find All. How do I fix this? |
#5
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Macro recorder not recording properly
I had completely forgotten that article!
-- Stefan Blom Microsoft Word MVP (Message posted via news.eternal-september.org) "Suzanne S. Barnhill" wrote in message ... For more on this subject, see http://word.mvps.org/FAQs/MacrosVBA/...ordedMacro.htm -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Stefan Blom" wrote in message ... I'm afraid it can't be fixed. The macro recorder has limited capabilities. At best, you can use it to get an understanding of which objects you need to look in to when you want to perform a certain task in VBA. Recorded macros must always (or almost always!) be edited if they should be truly useful. -- Stefan Blom Microsoft Word MVP (Message posted via news.eternal-september.org) "Al Almoian" wrote in message 3... Word 2003. I do a wildcard Find Highlight all then copy, ctrlHome,paste, it works great. But when I try to macro record this sequence it does not work. The debug on the Copy statement says nothing is selected. And the macro only has Find, not Find All. How do I fix this? |
#6
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Macro recorder not recording properly
Thank you Graham. It works great. |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Macro recorder not recording properly
You are welcome
-- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org "Al Almoian" wrote in message 3... Thank you Graham. It works great. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Recording Macro with Spike | Microsoft Word Help | |||
Recording a Macro | Microsoft Word Help | |||
Use mouse to select text in MS Word macro recorder. | Page Layout | |||
Macro not recording mailmerge | Mailmerge | |||
Macro Recorder | Microsoft Word Help |