Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
plh plh is offline
external usenet poster
 
Posts: 48
Default Programmatically call the Find and Replace window?

Hi All,
I am looking for a way to program the Find and Replace window. What I want to do
is set up a hot key to call the window with the contents of the selected cell in
the "Find What?" space. (Ordinarily I would just record a macro & alter what I
got but that recording feature does not seem to record anything when the Find
and Replace sub-window is used.)
Thank You,
-plh


--
Where are we going and why am I in this HAND BASKET??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Programmatically call the Find and Replace window?


Try


Code:
--------------------
Application.Dialogs(xlDialogFormulaFind).Show
--------------------


--
royUK

Hope that helps.

RoyUK
------------------------------------------------------------------------
royUK's Profile: http://www.thecodecage.com/forumz/member.php?userid=15
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=24999

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Programmatically call the Find and Replace window?

You can use Application.Dialogs(xlDialogFormulaReplace).Show to show the
dialog box and you can list the arguments afterwards to control the various
fields and other options. In your case, you would want something like
this...

Application.Dialogs(xlDialogFormulaReplace).Show ActiveCell.Value

which will fill the "Find what" field with the contents of the active cell.
You can also specify what to replace it with by specifying a second text
like so...

Application.Dialogs(xlDialogFormulaReplace).Show _
ActiveCell.Value, "Replacement Text"

Note that I deliberately used a line continuation character to force the
text wrap so that your newsreader wouldn't text wrap it at an odd location.

The arguments you can specify (in this order) a find_text, replace_text,
look_at, look_by, active_cell, match_case, match_byte

You can get the proper values to use for all of them (except for the
active_cell argument which I can find no documentation for) by looking up
the Find Method in the VBA help files. Here is a more complete example
showing one of the many possible combination of arguments (note that I
omitted the active_cell argument)

--
Rick (MVP - Excel)


"plh" wrote in message
...
Hi All,
I am looking for a way to program the Find and Replace window. What I want
to do
is set up a hot key to call the window with the contents of the selected
cell in
the "Find What?" space. (Ordinarily I would just record a macro & alter
what I
got but that recording feature does not seem to record anything when the
Find
and Replace sub-window is used.)
Thank You,
-plh


--
Where are we going and why am I in this HAND BASKET??


  #4   Report Post  
Posted to microsoft.public.excel.programming
Mio Mio is offline
external usenet poster
 
Posts: 2
Default Programmatically call the Find and Replace window?

Would this possibly help.

Sub CallFRWindow()
Dim FindPhrase As String
Dim ReplacePhrase As String
FindPhrase = ActiveCell.Value
ReplacePhrase = ""
Application.Dialogs(xlDialogFormulaReplace).Show FindPhrase,
ReplacePhrase
End Sub


Regards,

Mika Oukka



"plh" wrote in message
...
Hi All,
I am looking for a way to program the Find and Replace window. What I want
to do
is set up a hot key to call the window with the contents of the selected
cell in
the "Find What?" space. (Ordinarily I would just record a macro & alter
what I
got but that recording feature does not seem to record anything when the
Find
and Replace sub-window is used.)
Thank You,
-plh


--
Where are we going and why am I in this HAND BASKET??



  #5   Report Post  
Posted to microsoft.public.excel.programming
plh plh is offline
external usenet poster
 
Posts: 48
Default Programmatically call the Find and Replace window?

Thanks, that's nice, but I need a little more, and you seem like you would know.
I notice when I do this I don't get the "Find All" button. That is what I would
want. Ideally it would have the sub-window at the bottom already opened with the
results list.
I looked in the sources you mentioned and did not find out how to include that
button. I am doing this for people who are not so computer savvy & so seem to
have a problem doing it the way I do which is to just go Ctrl-C then Ctrl-F then
Ctrl-V
Thanx,
-plh

In article , Rick Rothstein says...

You can use Application.Dialogs(xlDialogFormulaReplace).Show to show the
dialog box and you can list the arguments afterwards to control the various
fields and other options. In your case, you would want something like
this...

Application.Dialogs(xlDialogFormulaReplace).Sho w ActiveCell.Value

which will fill the "Find what" field with the contents of the active cell.
You can also specify what to replace it with by specifying a second text
like so...

Application.Dialogs(xlDialogFormulaReplace).Sho w _
ActiveCell.Value, "Replacement Text"

Note that I deliberately used a line continuation character to force the
text wrap so that your newsreader wouldn't text wrap it at an odd location.

The arguments you can specify (in this order) a find_text, replace_text,
look_at, look_by, active_cell, match_case, match_byte

You can get the proper values to use for all of them (except for the
active_cell argument which I can find no documentation for) by looking up
the Find Method in the VBA help files. Here is a more complete example
showing one of the many possible combination of arguments (note that I
omitted the active_cell argument)

--
Rick (MVP - Excel)


"plh" wrote in message
...
Hi All,
I am looking for a way to program the Find and Replace window. What I want
to do
is set up a hot key to call the window with the contents of the selected
cell in
the "Find What?" space. (Ordinarily I would just record a macro & alter
what I
got but that recording feature does not seem to record anything when the
Find
and Replace sub-window is used.)
Thank You,
-plh


--
Where are we going and why am I in this HAND BASKET??




--
Where are we going and why am I in this HAND BASKET??


  #6   Report Post  
Posted to microsoft.public.excel.programming
Mio Mio is offline
external usenet poster
 
Posts: 2
Default Programmatically call the Find and Replace window?

Sound like I would be better to through the tedious task of teaching
everyone how to use the "Find Next"- and "Replace"-button.

BR,

Mika Oukka


"plh" wrote in message
...
Thanks, that's nice, but I need a little more, and you seem like you would
know.
I notice when I do this I don't get the "Find All" button. That is what I
would
want. Ideally it would have the sub-window at the bottom already opened
with the
results list.
I looked in the sources you mentioned and did not find out how to include
that
button. I am doing this for people who are not so computer savvy & so seem
to
have a problem doing it the way I do which is to just go Ctrl-C then
Ctrl-F then
Ctrl-V
Thanx,
-plh

In article , Rick Rothstein says...

You can use Application.Dialogs(xlDialogFormulaReplace).Show to show the
dialog box and you can list the arguments afterwards to control the
various
fields and other options. In your case, you would want something like
this...

Application.Dialogs(xlDialogFormulaReplace).Sh ow ActiveCell.Value

which will fill the "Find what" field with the contents of the active
cell.
You can also specify what to replace it with by specifying a second text
like so...

Application.Dialogs(xlDialogFormulaReplace).Sh ow _
ActiveCell.Value, "Replacement Text"

Note that I deliberately used a line continuation character to force the
text wrap so that your newsreader wouldn't text wrap it at an odd
location.

The arguments you can specify (in this order) a find_text,
replace_text,
look_at, look_by, active_cell, match_case, match_byte

You can get the proper values to use for all of them (except for the
active_cell argument which I can find no documentation for) by looking up
the Find Method in the VBA help files. Here is a more complete example
showing one of the many possible combination of arguments (note that I
omitted the active_cell argument)

--
Rick (MVP - Excel)


"plh" wrote in message
...
Hi All,
I am looking for a way to program the Find and Replace window. What I
want
to do
is set up a hot key to call the window with the contents of the selected
cell in
the "Find What?" space. (Ordinarily I would just record a macro & alter
what I
got but that recording feature does not seem to record anything when the
Find
and Replace sub-window is used.)
Thank You,
-plh


--
Where are we going and why am I in this HAND BASKET??




--
Where are we going and why am I in this HAND BASKET??



Reply
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
Find & replace window DreamKid Excel Worksheet Functions 0 December 10th 09 08:30 PM
'Match' field in Find and Replace window denhamlee Excel Discussion (Misc queries) 0 September 19th 07 02:11 PM
Bring up the "find and replace" window [email protected] Excel Programming 3 July 30th 07 05:23 PM
Open the Find & Replace Window Using a Macro [email protected] Excel Programming 6 May 8th 07 05:20 PM
Find/Replace in VBE takes focus off window Excel 2003 ward376 Excel Programming 0 January 18th 07 11:14 PM


All times are GMT +1. The time now is 02:52 AM.

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

About Us

"It's about Microsoft Excel"