Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how to get vba to display excel 2002+ "Find & Replace" dialog

Using VBA, one can display most if not all of Excel's builtin dialogs,
using code such as:

application,dialogs().show

The object browser shows the enum for the constants (such as
xlDialogFormulaReplace in the example above). However, I cant find
such a constant for the new single box "Find & Replace" dialog
introduced in Excel 2002 and beyond and described in KB288291. Any
ideas on how to display this puppy?

Major

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default how to get vba to display excel 2002+ "Find & Replace" dialog

I don't have 2002 but this works in 2000

b = Application.Dialogs(xlDialogFormulaReplace).Show( _
"find_text", "replace_text")
' see other arg's in help, best to reset them

Regards,
Peter T



wrote in message
oups.com...
Using VBA, one can display most if not all of Excel's builtin dialogs,
using code such as:

application,dialogs().show

The object browser shows the enum for the constants (such as
xlDialogFormulaReplace in the example above). However, I cant find
such a constant for the new single box "Find & Replace" dialog
introduced in Excel 2002 and beyond and described in KB288291. Any
ideas on how to display this puppy?

Major



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how to get vba to display excel 2002+ "Find & Replace" dialog

Peter T. -
This works in Excel 2003 as well, but in is not raising the new Single
Box Find & Replace dialog mentioned in the KB article I cited. Which I
need to use since 1) it has a "Find All" feature and 2) it is
modeless.
Thanks for the response, tho.

Major


On Oct 23, 8:57 am, "Peter T" <peter_t@discussions wrote:
I don't have 2002 but this works in 2000

b = Application.Dialogs(xlDialogFormulaReplace).Show( _
"find_text", "replace_text")
' see other arg's in help, best to reset them

Regards,
Peter T

wrote in message

oups.com...



Using VBA, one can display most if not all of Excel's builtin dialogs,
using code such as:


application,dialogs().show


The object browser shows the enum for the constants (such as
xlDialogFormulaReplace in the example above). However, I cant find
such a constant for the new single box "Find & Replace" dialog
introduced in Excel 2002 and beyond and described in KB288291. Any
ideas on how to display this puppy?


Major- Hide quoted text -


- Show quoted text -



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default how to get vba to display excel 2002+ "Find & Replace" dialog

I found a solution. Ironically, it was by looking at Peter T.'s
profile and earlier posts.

I found the command button that corresponded to the menu "Find"
function by enumerating the ID & Caption of the commandbar objects to
find the ID (1849) and then executed the cmd to raise the dialog.

Dim c As CommandBarButton

On Error Resume Next
Dim colCtrs As Collection

Set colctrls = CommandBars.FindControls
For Each c In colctrls
If InStr(1, c.Caption, "&Find") 0 Then
Debug.Print c.ID & " : " & c.Caption & " : " & c.Tag & " : " &
c.Type & " : " & c.DescriptionText
End If
Next

I then used SENDKEYS to fill out and run the dialog itself. Not
pretty, but effective.

Set c = CommandBars.FindControl(ID:=1849) ' Find
c.Execute

With Application
.SendKeys ("ERR:{TAB}")
.SendKeys ("%t{TAB}")
.SendKeys ("&hw{TAB}")
.SendKeys ("%s{DOWN}{TAB}")
.SendKeys ("%LC{DOWN}{DOWN}{TAB}")
.SendKeys ("%i~~")
End With

Thanks for the inspiration.

Major

On Oct 23, 9:36 am, wrote:
Peter T. -
This works in Excel 2003 as well, but in is not raising the new Single
Box Find & Replace dialog mentioned in the KB article I cited. Which I
need to use since 1) it has a "Find All" feature and 2) it is
modeless.
Thanks for the response, tho.

Major

On Oct 23, 8:57 am, "Peter T" <peter_t@discussions wrote:



I don't have 2002 but this works in 2000


b = Application.Dialogs(xlDialogFormulaReplace).Show( _
"find_text", "replace_text")
' see other arg's in help, best to reset them


Regards,
Peter T


wrote in message


roups.com...


Using VBA, one can display most if not all of Excel's builtin dialogs,
using code such as:


application,dialogs().show


The object browser shows the enum for the constants (such as
xlDialogFormulaReplace in the example above). However, I cant find
such a constant for the new single box "Find & Replace" dialog
introduced in Excel 2002 and beyond and described in KB288291. Any
ideas on how to display this puppy?


Major- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default how to get vba to display excel 2002+ "Find & Replace" dialog

Really, I don't recall posting anything quite like that but if it works I'll
take credit for it <g

However think I would change -

Dim c As CommandBarButton

On Error Resume Next
Dim colCtrs As Collection

Set colctrls = CommandBars.FindControls


to
Dim c as Object 'CommandBarButton, CommandBarButton, CommandBarComboBox etc
dim colctrls as CommandbarConrols

Set colctrls = CommandBars.FindControls

or simply

for each c in CommandBars.FindControls

Regards,
Peter T



wrote in message
ups.com...
I found a solution. Ironically, it was by looking at Peter T.'s
profile and earlier posts.

I found the command button that corresponded to the menu "Find"
function by enumerating the ID & Caption of the commandbar objects to
find the ID (1849) and then executed the cmd to raise the dialog.

Dim c As CommandBarButton

On Error Resume Next
Dim colCtrs As Collection

Set colctrls = CommandBars.FindControls
For Each c In colctrls
If InStr(1, c.Caption, "&Find") 0 Then
Debug.Print c.ID & " : " & c.Caption & " : " & c.Tag & " : " &
c.Type & " : " & c.DescriptionText
End If
Next

I then used SENDKEYS to fill out and run the dialog itself. Not
pretty, but effective.

Set c = CommandBars.FindControl(ID:=1849) ' Find
c.Execute

With Application
.SendKeys ("ERR:{TAB}")
.SendKeys ("%t{TAB}")
.SendKeys ("&hw{TAB}")
.SendKeys ("%s{DOWN}{TAB}")
.SendKeys ("%LC{DOWN}{DOWN}{TAB}")
.SendKeys ("%i~~")
End With

Thanks for the inspiration.

Major

On Oct 23, 9:36 am, wrote:
Peter T. -
This works in Excel 2003 as well, but in is not raising the new Single
Box Find & Replace dialog mentioned in the KB article I cited. Which I
need to use since 1) it has a "Find All" feature and 2) it is
modeless.
Thanks for the response, tho.

Major

On Oct 23, 8:57 am, "Peter T" <peter_t@discussions wrote:



I don't have 2002 but this works in 2000


b = Application.Dialogs(xlDialogFormulaReplace).Show( _
"find_text", "replace_text")
' see other arg's in help, best to reset them


Regards,
Peter T


wrote in message


roups.com...


Using VBA, one can display most if not all of Excel's builtin

dialogs,
using code such as:


application,dialogs().show


The object browser shows the enum for the constants (such as
xlDialogFormulaReplace in the example above). However, I cant find
such a constant for the new single box "Find & Replace" dialog
introduced in Excel 2002 and beyond and described in KB288291. Any
ideas on how to display this puppy?


Major- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -





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" a wildcard as a place marker and "replace" with original va Eric Excel Discussion (Misc queries) 1 January 27th 09 06:00 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How to replace "#N/A" w "0"when vlookup couldn't find the match? Holly Excel Discussion (Misc queries) 2 July 17th 06 11:48 PM
Replace dialog should put focus on "Find What" not "Replace With" Michael Williams Excel Discussion (Misc queries) 0 May 24th 06 12:45 PM
VBA code to display the "Find" (Ctrl+F) dialog box lothario[_28_] Excel Programming 2 October 17th 03 10:28 AM


All times are GMT +1. The time now is 06:30 PM.

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"