Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Unable to close 2nd user form

I am just beginning to learn how to use forms. I was able to get one
form to open and close fine, then I added a 2nd form. I admit I am
working by Rote, as I do not yet fully understand what I am coding.

Here is the code I use to open the 1st user form (I left out some
stuff that did not seem essential to the question).
Sub form1()
UserForm.Show
If UserForm.OptionButton1.Value = True Then Range("A10").Value = 7
If UserForm.OptionButton2.Value = True Then Range("A10").Value = 6
If Range("A10").Value = 6 Then Call ConfirmDecision
End Sub
------------------------------------------------------------------
Then in the forms coding, I put

Private Sub CommandButton1_Click()
UserForm.Hide
End Sub

Private Sub UserForm_Click()
End Sub
================================================== =====
The 2nd form opens fine...but when I click on the button to try to
close it, I get an error message

UserForm1.Show

If UserForm1.OptionButton1.Value = True Then Range("B8").Value = 8
If UserForm1.OptionButton2.Value = True Then Range("B8").Value = 9
Range("F13").Select

Private Sub CommandButton1_Click()
UserForm1.Hide
End Sub

Private Sub UserForm1_Click()
End Sub

I have spent hours of trial and error. Any help would really be
appreciated.

RJQman

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Unable to close 2nd user form

hi,
from your code i see you are loading them as modal. when a form is modal, the
user must respond before using any other part of the application. No
subsequent code is executed until the form is hidden or unloaded. to set as
modaless...

Yourform.show 0

if you omit the zero, the form will load as modal. modal = 1. Modal is
default.

regards,
FSt1



" wrote:

I am just beginning to learn how to use forms. I was able to get one
form to open and close fine, then I added a 2nd form. I admit I am
working by Rote, as I do not yet fully understand what I am coding.

Here is the code I use to open the 1st user form (I left out some
stuff that did not seem essential to the question).
Sub form1()
UserForm.Show
If UserForm.OptionButton1.Value = True Then Range("A10").Value = 7
If UserForm.OptionButton2.Value = True Then Range("A10").Value = 6
If Range("A10").Value = 6 Then Call ConfirmDecision
End Sub
------------------------------------------------------------------
Then in the forms coding, I put

Private Sub CommandButton1_Click()
UserForm.Hide
End Sub

Private Sub UserForm_Click()
End Sub
================================================== =====
The 2nd form opens fine...but when I click on the button to try to
close it, I get an error message

UserForm1.Show

If UserForm1.OptionButton1.Value = True Then Range("B8").Value = 8
If UserForm1.OptionButton2.Value = True Then Range("B8").Value = 9
Range("F13").Select

Private Sub CommandButton1_Click()
UserForm1.Hide
End Sub

Private Sub UserForm1_Click()
End Sub

I have spent hours of trial and error. Any help would really be
appreciated.

RJQman


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
Close User Form Gazz_85[_2_] Excel Discussion (Misc queries) 1 July 8th 09 10:38 AM
Call user form from ThisWorkbook; close file if form closed XP Excel Programming 2 July 20th 07 07:04 PM
close user form ViestaWu Excel Programming 5 July 14th 06 02:53 PM
Close user form when button is pressed april27 Excel Programming 1 June 16th 06 11:03 AM
Open Only the User Form ... or Close Everything ! monir Excel Programming 4 April 2nd 06 09:30 PM


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