Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Mar 2006
    Location
    United Kingdom
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Combo box value in user form (Word 2003 SP2)

    I'm using the following code to store the value of a combo box to a variable for use later, but in the Watch Window the value doesn't change. I tried declaring the variable (mSecLevel) as public but it didn't make any difference. Could someone tell me what I'm doing wrong?

    Private Sub cboSecurityLevel_AfterUpdate()
    Dim mSecLevel As String
    mSecLevel = cboSecurityLevel.Value
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Combo box value in user form (Word 2003 SP2)

    You shouldn't declare mSecLevel in the After Update event procedure. If you need it as long as the form is open, place the declaration at the top of the form's module:

    Private mSecLevel As String

    If you need the value to be available after the form has been closed, place the declaration at the top of a standard module:

    Public mSecLevel As String

Posting Permissions

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