Loading
Ozgrid Excel Help & Best Practices Forums

Excel Training / Excel Dashboards Reports



Results 1 to 6 of 6

Thread: Unload a UserForm?

  1. #1
    Join Date
    30th November 2004
    Location
    Thetford, Norfolk, UK
    Posts
    204

    Unload a UserForm?

    Thanks for everyones help so far..

    Question: I have Userforms that are displayed by Command Buttons when clicked hides one and shows another
    Code:
    Private Sub CommandButton2_Click()
     UserForm6.Hide
     UserForm8.Show
    End Sub
    Problem is, else where in the program I have a Maintenance Menu that sets a "maintenance value" to off or on, I have the following code used in the UserForm_Initialize that fires the first time a UserForm loads, but doesnt fire again if the page is re-displayed.
    Code:
    Private Sub UserForm_Initialize()
    ' Added Maintence Option for use in TroubleShooting - 3/2/02
    MaintOption = Worksheets("Data").Cells(1, 13).Value
    If MaintOption = "On" Then
     CommandButton4.Caption = "Test Info"
    ElseIf MaintOption = "Off" Then
     CommandButton4.Caption = ""
     CommandButton4.Enabled = False
      End If
    End Sub
    If I change the Maintenance Option from Off to On, and I have already been on that page, I need the Button to be displayed and same goes if I have already been to the page, see I forgot to turn on the maintenace option, go back turn it on, It won't display the button still, the UserForm_Initialize doesn't fire again..

    Any ideas on what to change ?
    Thanks!
    Joe
    Last edited by Jack in the UK; December 3rd, 2004 at 07:51. Reason: Code Tags Added - jiuk

    Excel Video Tutorials / Excel Dashboards Reports


  2. #2
    Join Date
    26th January 2003
    Location
    UK
    Posts
    4,684

    Re: Unload a UserForm?

    Hi Joe

    Just a quick one can you please use Code Tags [i have added them for you] when you post VBA just the way we like the codes postsed on OzGrid and you have to admind they look clear and super cool, not to add makes my adminstration easier, not digging buddy - but also helps for other members reading this post in the future.

    Many thank for your understanding

    Jack

    Excel Video Tutorials / Excel Dashboards Reports


  3. #3
    Join Date
    30th November 2004
    Location
    Thetford, Norfolk, UK
    Posts
    204

    Re: Unload a UserForm?

    Hey no problem, I was wondering how that was done.
    I thought that was kewl looking too. Thanks for the heads up. I will use them from now on.

    Excel Video Tutorials / Excel Dashboards Reports


  4. #4
    Join Date
    30th November 2004
    Location
    Thetford, Norfolk, UK
    Posts
    204

    Re: Unload a UserForm?

    Hey all... still looking for a fix, and nothing is working right..

    I read up on Load and Unloading UserForms, but for some reason, it will not work.

    I have tried

    Code:
    UserForm6.Hide
     Unload UserForm6
      Load UserForm8
     UserForm8.Show
    I have tried the:

    Code:
    Unload Me
       UserForm8.Show
    All to no avail, when I leave and go back to the form, its still populated and the UserForm Initialize does not fire again. Maybe it will only fire once per open workbook session, if thats the case, any ideas on how to do this? Clearing the form isn't an issue, its just when the form loads, it needs to look for a value and react accordingly.. so I need something that will check for that value every time..

    Ideas ? Thanks.

    Joe

    Excel Video Tutorials / Excel Dashboards Reports


  5. #5
    Join Date
    7th March 2003
    Location
    Essex, England
    Posts
    11,310

    Re: Unload a UserForm?

    Hi Joe,

    Try moving the code into the Activate event.

    Code:
    Private Sub UserForm_Activate()
    
    End Sub

    Cheers
    Andy


  6. #6
    Join Date
    30th November 2004
    Location
    Thetford, Norfolk, UK
    Posts
    204

    Re: Unload a UserForm?

    Andy,

    You ROCK! I didn't know about that event... that will help ALL over my project. THANK YOU!



    Joe

    Excel Video Tutorials / Excel Dashboards Reports


Thread Information

Users Browsing this Thread

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

Possible Answers

  1. Unload Userform Causes Another To Unload
    By mustang_07 in forum EXCEL HELP
    Replies: 3
    Last Post: January 10th, 2008, 10:13
  2. Unload Userform After Delay
    By rpaulson in forum EXCEL HELP
    Replies: 3
    Last Post: June 22nd, 2007, 09:08
  3. unload a msgbox (not userform)
    By J88L in forum EXCEL HELP
    Replies: 2
    Last Post: December 14th, 2005, 04:20
  4. Userform does not unload
    By Mel B. in forum EXCEL HELP
    Replies: 4
    Last Post: February 3rd, 2005, 05:37
  5. Userform unload bugout
    By GeorgeB in forum EXCEL HELP
    Replies: 7
    Last Post: April 8th, 2003, 01:31

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
  •  
porno