View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Leith Ross[_454_] Leith Ross[_454_] is offline
external usenet poster
 
Posts: 1
Default Show Modeless Form


Hello Michael

Add a VBA module to project and copy this code into it. In th
*UserForm_Activate()* code add this to call the macro..

MAKENONMODA

Code
-------------------


'Declare API calls and constant
Private Declare Function FindWindow
Lib "User32.dll"
Alias "FindWindowA"
(ByVal lpszClass As String,
ByVal lpszWindow As String) As Lon

Private Declare Function FindWindowEx
Lib "User32.dll"
Alias "FindWindowExA"
(ByVal hWndParent As Long,
ByVal hWndChildAfter As Long,
ByVal lpszClass As String,
ByVal lpszWindow As String) As Lon

Private Declare Function EnableWindow
Lib "User32.dll"
(ByVal hWnd As Long,
ByVal wCmd As Long) As Lon

Private Declare Function GetWindow
Lib "User32.dll"
(ByVal hWnd As Long, ByVal wCmd As Long) As Lon

'Returns the Window Handle of the Active Windo
Public Declare Function GetActiveWindow
Lib "User32.dll" () As Lon

Const GW_OWNER As Long = &H
Const WS_ENABLE As Long = &HFFFFFFF


Public Sub MakeNonModal(

Dim RetVa
Dim hWkb As Lon
Dim hWks As Lon
Dim OwnerWindow As Lon

'Owner Window is Exce
OwnerWindow = GetWindow(GetActiveWindow(), GW_OWNER

'Get Window Handle of Workbook Windo
hWkb = FindWindowEx(OwnerWindow, 0&, "XLDESK", vbNullString

'Get Window Handle to the Worksheet Windo
hWks = FindWindowEx(hWkb, 0&, "EXCEL7", vbNullString

RetVal = EnableWindow(OwnerWindow, WS_ENABLE

End Su

-------------------

Sincerely
Leith Ros

--
Leith Ros
-----------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...fo&userid=1846
View this thread: http://www.excelforum.com/showthread.php?threadid=49766