Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: How to Unload a Form
Thanks Thanks: 0 Likes Likes: 0

  1. #11
    Board Regular
    Join Date
    May 2011
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: How to Unload a Form

    Quote Originally Posted by mikerickson View Post
    Are you repeatedly calling ShowForm? Are you putting each instance of myUserForm in your own collection after it is created? That collection would be a good way to keep all the run-time UFs handy for referencing.
    Yes I repeatedly call ShowForm for different tags, X, Y, Z and to assign different control values available on the form. I assume Excel puts all these newly created forms in Userforms collection. And I can loop through them using this collection managed by Excel. Therefore, I don't do anything further. Am I right?

    Quote Originally Posted by mikerickson View Post
    Alternatly, to mark a userform as "made" you could put an "x" in the .Tag property of the userform. That avoids the error handling to check if someForm has a myLabel control.
    That's a beautiful idea! I will certainly use it. It will help a lot, timewise for my VBA code.

    Quote Originally Posted by mikerickson View Post
    On another level, why all the run-time userforms? An existing userform that has Pages added to its Multi-page control at run time seems a more stable control.
    I would love to do it, but it is way beyond my current level of Excel knowledge. If you would be kind to show me how to set up that multi page forms, I would appreciate. Nevertheless, I would also love to know how to get around my problem I am currently suffering from. How can I unload my primitive forms from memory based on the setup I have used. I just spend too much time for this setup and I cannot ignore it completely at the moment.

    Many many thanks indeed.

  2. #12
    Board Regular
    Join Date
    May 2011
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: How to Unload a Form

    Quote Originally Posted by rorya View Post
    Why not just:
    Code:
    Unlaod myForm
    then, given that your variable points at a specific instance.
    That just does not work. It is the first thign I have tried...

  3. #13
    Board Regular
    Join Date
    May 2011
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: How to Unload a Form

    Quote Originally Posted by eros View Post
    That just does not work. It is the first thign I have tried...
    Let me be more specific... It removes all forms already open on my screen. However I target only specific forms with a special tag value.

  4. #14
    Board Regular
    Join Date
    May 2011
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: How to Unload a Form

    Quote Originally Posted by eros View Post
    Let me be more specific... It removes all forms already open on my screen. However I target only specific forms with a special tag value.
    Gee!!! I checked my code once again, it works now. It is a simple if check error on my side for tag values. "Unload myForm" works.

    Sorry for bothering. How I am ashamed, I cannot tell enough.

    However, you have given me great suggestions. Thanks for all...

    Nevertheless, I am looking forward to multipage implementation of forms.

    Truly, many many thanks!!

  5. #15
    MrExcel MVP mikerickson's Avatar
    Join Date
    Jan 2007
    Location
    Davis CA
    Posts
    22,603
    Post Thanks / Like
    Mentioned
    20 Post(s)
    Tagged
    15 Thread(s)

    Default Re: How to Unload a Form

    I'm away from my Excel at the moment, so I can't be sure of the syntax of a
    UserForm1.MultiPage1.Pages.Add statement.

    One further step in simplification would ask Why have different instances of the same userform? If each userform does the same thing to the different objects that it is "pointed" at, it might be more stable to have one userform and with a variable "pointer", than many userforms with fixed "pointers". As you can tell, this approach would be very use dependent, so What are you doing with each of these userforms?

  6. #16
    Board Regular
    Join Date
    May 2011
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: How to Unload a Form

    Quote Originally Posted by mikerickson View Post
    I'm away from my Excel at the moment, so I can't be sure of the syntax of a
    UserForm1.MultiPage1.Pages.Add statement.

    One further step in simplification would ask Why have different instances of the same userform? If each userform does the same thing to the different objects that it is "pointed" at, it might be more stable to have one userform and with a variable "pointer", than many userforms with fixed "pointers". As you can tell, this approach would be very use dependent, so What are you doing with each of these userforms?
    No worries Mike. I myself can look up multipage and relevant syntax. With this multipage approach is it possible to collect all different forms in one place and switch to each form as if it is a page of book? Then it might work for me.

    As you say Mike, in my case I think this is what I need. I didn't quite understand your "pointed" approach; however, I can say that each form, being a different instance of a UserForm, holds different data, well a block of data by means of label controls on the form. So I need these forms seperately, and sequentially as if a database record. I check the label controls as my data fields and use them further in my VBA code. I hope this explains what I am up to.

    Many many thanks again for your kind assistance.

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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