Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Al Almoian Al Almoian is offline
external usenet poster
 
Posts: 8
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Suzanne S. Barnhill Suzanne S. Barnhill is offline
external usenet poster
 
Posts: 33,624
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom[_3_] Stefan Blom[_3_] is offline
external usenet poster
 
Posts: 6,897
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Al Almoian Al Almoian is offline
external usenet poster
 
Posts: 8
Default Macro recorder not recording properly



Thank you Graham. It works great.
  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recording Macro with Spike kaoinla Microsoft Word Help 3 July 23rd 09 05:30 AM
Recording a Macro dorita Microsoft Word Help 1 October 17th 06 06:59 AM
Use mouse to select text in MS Word macro recorder. hellbent Page Layout 3 October 10th 06 11:54 AM
Macro not recording mailmerge LDanix Mailmerge 3 August 24th 06 07:47 AM
Macro Recorder auntme Microsoft Word Help 3 December 7th 04 04:14 PM


All times are GMT +1. The time now is 12:34 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"