MACRO MALFUNCTION

R

Rebecca

Greetings. I have made a macro that does the following: Finds a certain
letter in a certain font, selects the entire word, copies it, then in another
(bottom) pane in the same document makes a hyperlink and then goes back to
the upper pane. But I keep getting an error message at the third line from
the bottom (ActiveWindow.Next.Activate). Could someone please tell me where
the program is? I am ignorant of programming, so could you please explain in
easy English? The document contains a list of words.

Sub COG_LXX()
'
' COG_LXX Macro
' LIFEBOOK E8010Sì´(ê°€) 기ë¡í•œ 매í¬ë¡œ 2004-12-01
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchByte = False
.CorrectHangulEndings = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=wdExtend
Selection.Copy
Selection.MoveRight Unit:=wdCharacter, Count:=1
ActiveWindow.ActivePane.Next.Activate
Selection.PasteSpecial Link:=True, DataType:=wdPasteHyperlink
ActiveWindow.Next.Activate
ActiveWindow.ActivePane.Next.Activate
End Sub
 
W

Word Heretic

G'day "Rebecca" <[email protected]>,

This is not the best way of doing things. You need to use Range
objects to mark your positions in the text stream of the document.
Selection is being used as a range object.

If you go to www.editorium.com and look for some back articles on Find
and Replace solutions, you will find a number of articles to help get
you up to speed with some proper solutions.

Steve Hudson - Word Heretic

steve from wordheretic.com (Email replies require payment)
Without prejudice


Rebecca reckoned:
 

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