LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 92
Default Conditional Unloading of a Userform (I've got in a right pickle)

The Story so far!

I have a userform with 3 Command buttons and 2 toggle buttons.

The 2 tog buts trigger an ontime event each in a standard mudule. this all
works fine.
1 command button hides the userform and the other one, which is a cancel
button is where I'm having a bit of a problem.

What I want to happen is when clicked, the state of the 2 tog but are
checked and if both are false, then unload the form. If either one or both
are true then a message box pops up with do you want to continue with vbYes
and vbNo buttons.
If the user says yes then a sub is run to change tog buttons to false then
the form unloads. If no is chosen then the msgbox diappears and the userform
is left open.

Hears what i have so far

Private Sub CommandButton1_Click()
On Error Resume Next
MkDir "C:\AutoSaves"
On Error GoTo 0
End Sub

Private Sub CommandButton2_Click() 'Caption is Hide
frmOptions.Hide
End Sub


Private Sub CommandButton3_Click() ' Caption is Cancel
If frmOptions.ToggleButton1.Value = True Then
ElseIf frmOptions.ToggleButton2.Value = True Then 'Can these to line be
combine to give
' a boolean and argument
Dim Msg, Style, Title, Response
Msg = "Do you want to Cancel Auto Save ?" 'This bit all works fine
Style = vbYesNo
Title = "Cancel Auto Save Options"

Response = MsgBox(Msg, Style, Title)
If Response = vbYes Then ' User chose Yes.
CancelToggles ' Run sub

Else ' User chose No.
Hide ' Hides the userform
End If ' upto hear happens if either one or both the toggle buttons are true



Else
Unload Me 'I want the userform to unload if both togglr buttons are false
End If
End If
End Sub

Private Sub CancelToggles()
ToggleButton1.Value = False
ToggleButton2.Value = False
End Sub


Can normal ws funtions like AND and LOGICAL be call upon for something like
this?

Please help my brain is liquifying and draining out my ears!
 
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
Correct code to Exit Userform, with out Unloading data Corey Excel Programming 13 January 8th 07 12:25 AM
Getting error unloading Userform?? Ed Excel Programming 3 July 1st 05 12:27 AM
Unloading UserForm not working Marston Excel Programming 2 August 17th 04 04:18 AM
Unloading userform in MSComm event Sunny[_4_] Excel Programming 0 June 10th 04 06:04 PM
Not Unloading a UserForm Mike[_49_] Excel Programming 1 January 29th 04 11:45 PM


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