LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Finding and selecting text in word from excel

This one is actually embarrassingly simple. I am missing the statement
Selection.Find.Execute at the end of the find code. I guess the find
property needs an additional step to be completed. The working code
goes:


Set wdapp = GetObject(, "Word.Application")
Set wddoc = wdapp.ActiveDocument

With wddoc.Content.find
.Text = "Q1"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchAllWordForms = False
.Execute (findtext = "Q1")
End With

selection.find.execute
End Sub


wrote:
Hello--I have written a simple macro trying to find and select certain
text in a word document (it is part of a larger project). When the
macro is finished running, I would like word to have the first instance
of the text selected. However, the following code is not doing the job.
I am sure I am missing something simple. Can anyone help?
-Abe

Sub find()



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding a single word match in a text string and assigning a code Morton Detwyler[_2_] Excel Worksheet Functions 6 September 15th 09 09:18 PM
Excel 2007 B2 - Selecting every cell that starts with a certain word [email protected] Excel Discussion (Misc queries) 13 July 9th 06 09:08 PM
Finding a cell, selecting the one down lonfnico[_2_] Excel Programming 5 April 12th 06 10:26 AM
Finding read-only & pwd protection attibutes of Word & Excel files Eithne R Excel Programming 3 February 20th 06 04:21 PM
Finding Words In Excel Spreadsheets & Word Documents rbonner79416 Excel Discussion (Misc queries) 0 March 18th 05 04:25 PM


All times are GMT +1. The time now is 06:51 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"