Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GH GH is offline
external usenet poster
 
Posts: 11
Default Userform freezes

I have the following code, which runs a random number generator. The process
takes about 45 seconds to complete, so I would like display a pop-up box to
inform the user to wait for the process to complete. The code runs fine, but
when I add in code to show the userform I've created and then hide it, the
whole things just hangs and never finishes. Does anyone have a suggestion on
what may be wrong with calling the useform?

Sub TerminalValue()
'
' TerminalValue Macro
'

'
'Application.ScreenUpdating = False
'Application.Visible = False

Load UserForm1

UserForm1.Show
Application.Calculation = xlManual

RANDOM

Calculate

Application.Calculation = xlAutomatic

Sheets("FINANCIAL INPUTS").Select
Range("C10").Select
Range("C10").GoalSeek Goal:=0, ChangingCell:=Range("B9")
Range("B16").Select

Horizon

cashflow


Sheets("Input4").Select

Range("A1").Select

'Application.ScreenUpdating = True
UserForm1.Hide
'Application.Visible = True


End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Userform freezes

When you show a form, it is typically by default Modal. This means
that no code following the Show method will execute until the form is
hidden or unloaded. Only code within the shown form can execute. You
change the behavior to Modeless, in which case the form will be shown
and code will continue after the Show method. E.g.,

Useform1.Show vbMiodeless

The problem arises that a form shown modally cannot show a modeless
form. So, if your main form is shown modally, you cannot display the
"please wait" form modelessly. You'll have to display the main form
modally as well.

Another option would be to put a Label control on the main form, with
a big red font, telling the user to wait. This would eliminate the
modal/modeless problem entirely.


Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Thu, 11 Dec 2008 14:36:17 -0800, GH
wrote:

I have the following code, which runs a random number generator. The process
takes about 45 seconds to complete, so I would like display a pop-up box to
inform the user to wait for the process to complete. The code runs fine, but
when I add in code to show the userform I've created and then hide it, the
whole things just hangs and never finishes. Does anyone have a suggestion on
what may be wrong with calling the useform?

Sub TerminalValue()
'
' TerminalValue Macro
'

'
'Application.ScreenUpdating = False
'Application.Visible = False

Load UserForm1

UserForm1.Show
Application.Calculation = xlManual

RANDOM

Calculate

Application.Calculation = xlAutomatic

Sheets("FINANCIAL INPUTS").Select
Range("C10").Select
Range("C10").GoalSeek Goal:=0, ChangingCell:=Range("B9")
Range("B16").Select

Horizon

cashflow


Sheets("Input4").Select

Range("A1").Select

'Application.ScreenUpdating = True
UserForm1.Hide
'Application.Visible = True


End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
GH GH is offline
external usenet poster
 
Posts: 11
Default Userform freezes

That info was very helpful Chip. The problem now is that if I run my dialog
box as modeless it appears washed out/blank and does not display as I
designed it. Do you know a way around this problem?

"Chip Pearson" wrote:

When you show a form, it is typically by default Modal. This means
that no code following the Show method will execute until the form is
hidden or unloaded. Only code within the shown form can execute. You
change the behavior to Modeless, in which case the form will be shown
and code will continue after the Show method. E.g.,

Useform1.Show vbMiodeless

The problem arises that a form shown modally cannot show a modeless
form. So, if your main form is shown modally, you cannot display the
"please wait" form modelessly. You'll have to display the main form
modally as well.

Another option would be to put a Label control on the main form, with
a big red font, telling the user to wait. This would eliminate the
modal/modeless problem entirely.


Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

On Thu, 11 Dec 2008 14:36:17 -0800, GH
wrote:

I have the following code, which runs a random number generator. The process
takes about 45 seconds to complete, so I would like display a pop-up box to
inform the user to wait for the process to complete. The code runs fine, but
when I add in code to show the userform I've created and then hide it, the
whole things just hangs and never finishes. Does anyone have a suggestion on
what may be wrong with calling the useform?

Sub TerminalValue()
'
' TerminalValue Macro
'

'
'Application.ScreenUpdating = False
'Application.Visible = False

Load UserForm1

UserForm1.Show
Application.Calculation = xlManual

RANDOM

Calculate

Application.Calculation = xlAutomatic

Sheets("FINANCIAL INPUTS").Select
Range("C10").Select
Range("C10").GoalSeek Goal:=0, ChangingCell:=Range("B9")
Range("B16").Select

Horizon

cashflow


Sheets("Input4").Select

Range("A1").Select

'Application.ScreenUpdating = True
UserForm1.Hide
'Application.Visible = True


End Sub


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
userform freezes sheet teepee[_3_] Excel Discussion (Misc queries) 2 October 26th 08 04:12 PM
For-Each-Next Freezes Excel J. Cornor Excel Programming 1 April 11th 07 09:58 PM
Excel freezes AJBell Excel Discussion (Misc queries) 1 December 8th 05 03:01 PM
userform freezes flow23 Excel Discussion (Misc queries) 1 November 24th 05 05:00 PM
Excel Freezes PeggySue Excel Programming 0 September 21st 04 06:01 PM


All times are GMT +1. The time now is 04:22 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"