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.
 

Some videos you may like

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
L

Legacy 98055

Guest
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
 

Watch MrExcel Video

Forum statistics

Threads
1,113,990
Messages
5,545,370
Members
410,679
Latest member
rolandbianco
Top