View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default modeless dialog box

Alan,
If I understand correctly, this does what you want.

Private Sub CommandButton2_Click()
Const FIND_REPLACE_DIALOG As Long = 1849
Application.CommandBars.FindControl(, FIND_REPLACE_DIALOG).Execute
End Sub

Ensure the command button has the .TakeFocusOnClick property=False.

NickHK

"acampbell" wrote in message
oups.com...
I need some help understanding why find dialog box, run via the
sendkeys method allows the dialog to run modeless yet, the second
routine will not run modeless. My users want to leave the find dialog
box open while making find & replace changes to their worksheet

I would prefer to use the vba format so I can set my arguments
aprpropriately, but need the modeless functionality of the sendkeys
routine.

Any help is greatly appreciated.

Alan

Sub find1()
With ActiveSheet
Application.Goto Reference:=Worksheets("Database").Range("A9")
Application.Goto Reference:=Worksheets("Database").Range("D9"), _
Scroll:=False
On Error Resume Next
SendKeys ("^f{BS}")
SendKeys ("%T")
SendKeys ("%LF~%N{ESC}"), Wait:=True
SendKeys "{BS}"
End With
End sub

Sub find2()
Application.Goto Reference:=Worksheets("Database").Range("D9"), _
Scroll:=True
Application.Dialogs(xlDialogFormulaFind).Show("", 1, 2, 2)