+ Reply to Thread
Results 1 to 16 of 16

Userfrom Property ShowModal = False

  1. #1
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    803

    Userfrom Property ShowModal = False

    The sample workbook is attached.

    When the workbook opens, the userform will automatically show.

    Issue at this point: if other workbooks are open before opening the attached workbook, it is not able to do anything on other workbooks.

    Close the userform, then reopen the userform by clicking the command button, now it is okay to do something on other workbooks.

    WHY....?
    Attached Files Attached Files

  2. #2
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    803

    Re: Userfrom Property ShowModal = False

    Attached: By the way, how to get rid of the things in red rectangle?

    Even a brand new workbook comes with them, and I don't even know where they came from. I don't even have password for SOLVER.

    Thanks.

    ------

    Never mind, is it from Add-In? Just leave it alone.
    Attached Images Attached Images

  3. #3
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,469

    Re: Userfrom Property ShowModal = False

    If you look in ThisWorkbook module, the WorkBook_Open event ... you have the UserForm loading as Modal.

    Delete the word "Modal"

  4. #4
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    803

    Re: Userfrom Property ShowModal = False

    Quote Originally Posted by Logit View Post
    If you look in ThisWorkbook module, the WorkBook_Open event ... you have the UserForm loading as Modal.

    Delete the word "Modal"
    Thanks much!!!

  5. #5
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,469

    Re: Userfrom Property ShowModal = False

    You are welcome !

  6. #6
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    803

    Re: Userfrom Property ShowModal = False

    Quote Originally Posted by Logit View Post
    You are welcome !
    There is still an issue. Let us say I have a second userform (Property ShowModal = True), and there is command button on second userform (Unload Me; FormLogin.Show) to return to the initial userform. What does "Unload Me" do? Does it really CLOSE the userform? It seems second userform still prevents me from working on other workbooks.

    I need to have second useform Property ShowModal = True

    BUT if I simply close the second useform by clicking system red X in the top right corner, it does not have the issue. It seems Unload Me is different from X in the top right corner.

  7. #7
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,469

    Re: Userfrom Property ShowModal = False

    The following information may be reveiwed at : http://http://gregmaxey.com/word_tip...nced_tips.html

    Look just a few paragraphs down the page and begin reading. Good information and better than I could explain.


    Understanding Call Methods

    Now that you understand the difference between the default instance and an explicit declaration instance of a form, I want to discuss methods of calling both types and the behavior observed in both with respect to the VBA Load and Set statements, and the userform .Show method, Initialize and Activate events.

    Modal Forms

    The easiest way to do this is with a series of demonstrations and experiments. To set up the demonstrations, perform these steps:
    The article specifically speaks to unloading a UserForm and using the X (upper right corner) to close the form.
    It also speaks to the command : " Set UserForm = Nothing "

    Please Login or Register  to view this content.
    Using the command " Set yourobject = Nothing " is not something I routinely use but perhaps I should ? In your case, it may assist with the issue of a closed Modal form still retaining
    focus.

    I created a sample project here with a UserForm and attempted to recreate what you are experiencing there. The UserForm displaying as Modal, then closing with a command button using
    the command " Unload Me " vs using the X on the form. I also tried the command UserForm.Hide . Nothing here allowed the UserForm to remain in memory and retain the Modal property
    preventing accessing other parts of the project.

    Please Login or Register  to view this content.
    Are you using some other command to close the UserForm ?

  8. #8
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Userfrom Property ShowModal = False

    Just as little clarification (didn't read all the posts)

    Loading a userform without specifying the mode loads it Modally... in other words:
    Please Login or Register  to view this content.
    Are the same thing.

    To show it modelessly then that must be specified
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    803

    Re: Userfrom Property ShowModal = False

    Quote Originally Posted by Logit View Post
    The following
    Thanks. I will try Set = Nothing tomorrow. I have only Unload Me to close the second userform, but of course there is some other code(for other tasks) before closing the userform.

  10. #10
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Userfrom Property ShowModal = False

    Quote Originally Posted by cytop View Post
    Just as little clarification (didn't read all the posts)

    Loading a userform without specifying the mode loads it Modally... in other words:
    Please Login or Register  to view this content.
    Are the same thing.

    To show it modelessly then that must be specified
    Please Login or Register  to view this content.
    In fact that depends on the form's ShowModal property. If that has been set to False, then the Show with no parameters will show it modelessly.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  11. #11
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    803

    Re: Userfrom Property ShowModal = False

    Quote Originally Posted by Logit View Post
    The fol

    Please Login or Register  to view this content.
    What is frmBasic? Is it form name? In my case, it is FormLogin? Dim oFrm AS .... ? I thought AS should be followed by data type.

    Thanks.

  12. #12
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Userfrom Property ShowModal = False

    Very True, but it's True by default and (in my experience) very few actually even know it exists in the Properties dialog so it never gets changed. I can't remember an instance where even experienced coders use the Property rather than specifying the ShowMode on loading.

    I guees I should have added 'In general...'

  13. #13
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    803

    Re: Userfrom Property ShowModal = False

    Quote Originally Posted by VAer View Post
    Thanks. I will try Set = Nothing tomorrow. I have only Unload Me to close the second userform, but of course there is some other code(for other tasks) before closing the userform.
    It may have something to do with first userform FormLogin, before showing second userform, I Unload FormLogin. Since it is Log In form, there is connection data, but I have set them to Nothing in FormLogin.

  14. #14
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Userfrom Property ShowModal = False

    Quote Originally Posted by VAer View Post
    What is frmBasic? Is it form name? In my case, it is FormLogin? Dim oFrm AS .... ? I thought AS should be followed by data type.

    Thanks.
    Yes, it is the form name. The form is itself a class (and interface) so you can create one or more instances of it, as with any class. Userforms are auto-instantiating, which is why you can refer to them as intrinsic objects without having to create a New instance, though it is regarded by many as better practice to do so.

  15. #15
    Forum Contributor VAer's Avatar
    Join Date
    09-10-2016
    Location
    USA
    MS-Off Ver
    Office 365
    Posts
    803

    Re: Userfrom Property ShowModal = False

    Quote Originally Posted by xlnitwit View Post
    Yes, it is the form name. The form is itself a class (and interface) so you can create one or more instances of it, as with any class. Userforms are auto-instantiating, which is why you can refer to them as intrinsic objects without having to create a New instance, though it is regarded by many as better practice to do so.
    Thanks. Good to know that it is okay to write "Dim .... AS FormName "

  16. #16
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    Excel 2019 Professional Plus - 2007 Enterprise
    Posts
    7,469

    Re: Userfrom Property ShowModal = False

    Quote Originally Posted by VAer View Post
    What is frmBasic? Is it form name? In my case, it is FormLogin? Dim oFrm AS .... ? I thought AS should be followed by data type.

    Thanks.
    Just a " pic " from the website. Not my coding....

    However, those form names are simply variables used to identify the form/s.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Runtime error 381: Could not set the list property.Invalid property array index
    By rohith4prithvi in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2014, 10:24 PM
  2. Listbox Resizes after setting the IntegralHeight Property to False on others machines
    By ryanparrish1986 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-05-2013, 09:06 AM
  3. [SOLVED] Excel run-time error '381': Could not set the List property. Invalid property array index
    By eemiller1997 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-20-2012, 12:48 PM
  4. page controls disappear when set multipage visible property to false
    By bdoodle in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-16-2011, 12:17 AM
  5. Understanding Cells property vs. Offset property (implicit vs explicit references)
    By Wedge120 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-26-2010, 10:38 PM
  6. Sum values based on TRUE/FALSE property on different sheet?
    By grantpanderson in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-19-2010, 11:38 AM
  7. [SOLVED] ShowModal property
    By VJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-13-2005, 01:06 PM
  8. [SOLVED] How to get ShowModal property
    By Andrea in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-09-2005, 09:32 AM

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