Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Nov 2005
    Location
    London, Gtr London, United Kingdom
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calling Userform (VBA/Powerpoint/2000)

    I am beginning to get my self extremely confused and frustrated over something I

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Star Lounger
    Join Date
    Nov 2005
    Location
    London, Gtr London, United Kingdom
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calling Userform (VBA/Powerpoint/2000)

    Thanks Hans.

    Sorry. In my original bit of code, I did have the vSeries after calling the form. Very tired today and not typing well!!

    I think the Public option is the one I'll look at, as in the original MySub, there are certain variables, which i forget to mention,

    many thanks

  4. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 16 Times in 16 Posts

    Re: Calling Userform (VBA/Powerpoint/2000)

    Why do you set the value of vSeries before showing the userform? That way, it doesn't matter what the user enters in textSeries.

    Your code doesn't check whether the user clicked the Cancel button, so "somemore code" is always executed.

    You could call "somemore code" from the On Click event of the OK button of the userform. That way, it won't be executed if the user clicks the Cancel button. This is probably the easiest method.

    Or you could use a public variable (in the standard module, not in the userform module) to let MySub and the userform communicate:

    - In the standard module:

    Public blnOK As Boolean

    Sub MySub()
    ' Declare local variable
    Dim vSeries As Single
    ' Initialize
    blnOK = False
    ' Show form
    frmExampleForm.Show
    ' Check whether user clicked OK
    If blnOK = True Then
    ' Read value
    vSeries = frmExampleForm.textSeries
    Somemore code
    End If
    End Sub

    - In the userform module:

    Private Sub cmdOK_Click()
    ' Set variable
    blnOK = True
    ' Hide userform (don't unload it!)
    Me.Hide
    End Sub

Posting Permissions

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