Results 1 to 5 of 5

passing variable from userform

Threaded View

  1. #1
    Valued Forum Contributor
    Join Date
    11-20-2003
    MS-Off Ver
    2010, 2016
    Posts
    1,176

    passing variable from userform

    I am using the following code to open a userform. Once the userform is open, the user has the option to choose a continue button or a cancel button. If the user is choosing continue, the code is not working (it always skips to the "else" portion of my "if" statement. I can't figure out why it is doing this. Thanks. I have attached a sample of workbook, if needed.
    Sub UpdateMasterFile()
    
    Dim Continue As String
    
        Load DisclaimerForm
        DisclaimerForm.Show
        
        If Continue = "Yes" Then
            'do some updates
            MsgBox "Update Complete!  ", vbInformation
        Else
            MsgBox "Update Canceled!  ", vbInformation
        End If
    
    End Sub
    Userform code:
    Private Sub CheckBox1_Click()
    
        If CheckBox1.Value = True Then
            ContinueButton.Enabled = True
        Else
            ContinueButton.Enabled = False
        End If
        
    End Sub
    Private Sub ContinueButton_Click()
        Unload DisclaimerForm
        Continue = "Yes"
    End Sub
    Private Sub CancelButton_Click()
        Unload DisclaimerForm
        Continue = "No"
    End Sub
    Attached Files Attached Files
    Last edited by maacmaac; 01-31-2010 at 08:22 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1