Detect Open Dialog Boxes

somf

New Member
Joined
May 2, 2005
Messages
17
Greetings all,

I am currently trying to detect the presence of certain dialog boxes within Excel, and can't figure a way. Specifically, I am looking to detect in code, during the SheetChange event, if the 'Find and Replace' dialog box is open.

Anyone have a way?

Thanks in advance.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
IsFindAndReplaceShowing.zip

<table width="100%" border="1" bgcolor="White" style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#FFFFFF', gradientType='0');"><tr><TD><font size="2" face=Courier New>  <font color="#0000A0">Private</font> <font color="#0000A0">Declare</font> <font color="#0000A0">Function</font> FindWindow <font color="#0000A0">Lib</font> "user32.dll" <font color="#0000A0">Alias</font> "FindWindowA" ( _
        <font color="#0000A0">ByVal</font> lpClassName <font color="#0000A0">As</font> String, _
        <font color="#0000A0">ByVal</font> lpWindowName <font color="#0000A0">As</font> String) <font color="#0000A0">As</font> <font color="#0000A0">Long</font>

  <font color="#0000A0">Private</font> <font color="#0000A0">Sub</font> Worksheet_Change(ByVal Target <font color="#0000A0">As</font> Range)
       <font color="#0000A0">If</font> FindWindow("bosa_sdm_XL9", "Find and Replace") <> 0 <font color="#0000A0">Then</font>
           MsgBox "Find and Replace is showing."
       <font color="#0000A0">Else</font>
           MsgBox "Find and Replace is not showing."
       <font color="#0000A0">End</font> <font color="#0000A0">If</font>
  <font color="#0000A0">End</font> <font color="#0000A0">Sub</font>
</FONT></td></tr></table><button onclick='document.all("10272006194715109").value=document.all("10272006194715109").value.replace(/<br \/>\s\s/g,"");document.all("10272006194715109").value=document.all("10272006194715109").value.replace(/<br \/>/g,"");window.clipboardData.setData("Text",document.all("10272006194715109").value);'>Copy to Clipboard</BUTTON><textarea style="position:absolute;visibility:hidden" name="10272006194715109" wrap="virtual">
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Private Sub Worksheet_Change(ByVal Target As Range)
If FindWindow("bosa_sdm_XL9", "Find and Replace") <> 0 Then
MsgBox "Find and Replace is showing."
Else
MsgBox "Find and Replace is not showing."
End If
End Sub</textarea>

IsFindAndReplaceShowing.zip
 
Upvote 0

Forum statistics

Threads
1,214,896
Messages
6,122,132
Members
449,066
Latest member
Andyg666

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top