Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I have a userform that is called from inside a sub in a module of a workbook. In order to keep most of the code inside the module, the userform only sets variables in the sub. Here is the code in the sub:
'create and initialize variables Dim Bkp,XSub as Boolean Dim BkpSfx as String Bkp = True XSub = False 'call options box BackupOptionsBox.Show 'Set main subroutine variables Bkp = BackupOptionsBox.YesOption BkpSfx = "_" & BackupOptionsBox.SfxBox.Value XSub = BackupOptionsBox.CancelButton.Value 'unload backup box Unload BackupOptionsBox Debug.Print ("Yes=" & Bkp & ", No=" & _ BackupOptionsBox.NoOption & ", XSub=" & XSub) 'Drop out of sub if cancel button was pushed If XSub Then prj.FileOpenEx Name:=PrjName & PrjXtn Exit Sub End If The box is has the following controls: 1. Two radio buttons, YesOption and NoOption, which toggle YesOption.Value 2. A text input field, SfxBox, for typing which is enabled when YesOption = True 3. An OK button 4. A Cancel button I have the following event sub for CancelButton: Private Sub CancelButton_Click() CancelButton.Value = True Me.Hide End Sub When I run the main subroutine and click the OK button, the code executes correctly (Bkp = True or False depending on the option button I selected, and XSub = False in the debug.print statement). However, when I just click the Cancel button, XSub remains false in the debug.print statement. Any ideas? EggHeadCafe - Software Developer Portal of Choice ASP Intrinsics Under COM Plus in the VB Windows 2000 ComponentASP http://www.eggheadcafe.com/tutorials...under-com.aspx |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Cancel/Exit Sub | Excel Discussion (Misc queries) | |||
how to create a macro button to exit a program | Excel Worksheet Functions | |||
how do i make a button from a userform exit onto the document in . | New Users to Excel | |||
Disable Exit button on a UserForm | Excel Discussion (Misc queries) | |||
How do i create a command button or macro to exit Microsoft Excel | Excel Worksheet Functions |