Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Show Modeless Form

I've been working through the NG trying to perfect this, but to no
avail. I'm trying to show a "Please Wait" modeless form (UserForm2) as
my workbook has numerous occurrences of a UDF that are all recalculated
when a user form (UserForm1) is closed. Here's my code:

Private Sub CommandButton3_Click()

UserForm1.Hide 'since I cannot show a modeless form while a
modal form is showing
UserForm2.Show vbModeless
Unload UserForm1

End Sub

'Code for UserForm2
Private Sub UserForm_Activate()

UserForm2.Caption = "Please wait"
Call Calculate
Unload UserForm2

End Sub

Private Sub Calculate()

Application.Calculate

End Sub
'End code

Thanks,
Mike.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 486
Default Show Modeless Form

While it is not a solution to your modeless issue why not just display a
message right on your UserForm1 asking the user to wait or use the
Application.StatusBar to display a message to the user. That seems a lot
easier.
--
HTH...

Jim Thomlinson


"Michael Malinsky" wrote:

I've been working through the NG trying to perfect this, but to no
avail. I'm trying to show a "Please Wait" modeless form (UserForm2) as
my workbook has numerous occurrences of a UDF that are all recalculated
when a user form (UserForm1) is closed. Here's my code:

Private Sub CommandButton3_Click()

UserForm1.Hide 'since I cannot show a modeless form while a
modal form is showing
UserForm2.Show vbModeless
Unload UserForm1

End Sub

'Code for UserForm2
Private Sub UserForm_Activate()

UserForm2.Caption = "Please wait"
Call Calculate
Unload UserForm2

End Sub

Private Sub Calculate()

Application.Calculate

End Sub
'End code

Thanks,
Mike.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Show Modeless Form

You are right, both are easy, but I was looking for "pretty." The
problem I'm running into is getting UserForm1 to unload before
UserForm2 loads.

Any other ideas?

  #4   Report Post  
Posted to microsoft.public.excel.programming
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

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
Print Preview and Modeless Form tmort[_2_] Excel Programming 1 July 22nd 05 09:05 PM
Removing focus from a Modeless Form? Ian Chappel Excel Programming 2 May 1st 04 07:54 PM
Activating a modeless form R Avery Excel Programming 2 February 4th 04 06:41 PM
Modeless but waiting form Zdenek Moravec Excel Programming 7 January 14th 04 02:00 PM
Modeless form for user interaction Arne[_2_] Excel Programming 6 July 15th 03 02:22 PM


All times are GMT +1. The time now is 03:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"