+ Reply to Thread
Results 1 to 4 of 4

UserForm determine if modeless?

  1. #1
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    UserForm determine if modeless?

    Is there anyway to tell from a form whether it was called modeless or not?

    i.e. Would it be possible to have a boolean function placed in a userform module and called from the form initialize event - which would return True/False value so you know whether the form was shown as .Show or .Show vbModeless?


    (This question is out of curiosity/increase theoretical knowledge only. No practical use that I can think of).
    *******************************************************

    HELP WANTED! (Links to Forum threads)
    Trying to create reusable code for Custom Events at Workbook (not Application) level

    *******************************************************

  2. #2
    Forum Expert
    Join Date
    04-22-2013
    Location
    .
    MS-Off Ver
    .
    Posts
    4,418

    Re: UserForm determine if modeless?

    well you just could set a hidden textbox on the userform to carry the property.

    Alternatively, I suppose
    UserForm1.show
    would return an error if it was already displayed modally, whereas it would not return an error if it was displayed modelessly. So you could use that to test.

  3. #3
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: UserForm determine if modeless?

    I do not think there can be a direct way because the userform has no property for this and the style bits of the window do not change whether it is modal or modeless.

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2012
    Location
    In lockdown
    MS-Off Ver
    Excel 2010 (2003 to 2016 but 2010 for choice)
    Posts
    1,766

    Re: UserForm determine if modeless?

    Quote Originally Posted by yudlugar View Post
    well you just could set a hidden textbox on the userform to carry the property.
    True. But I wanted to know if it could be determined from the form without passing anything to determine how it was called.


    Quote Originally Posted by yudlugar View Post
    Alternatively, I suppose
    UserForm1.show
    would return an error if it was already displayed modally, whereas it would not return an error if it was displayed modelessly. So you could use that to test.
    Bingo. That's what helped me solve it. +1


    Please Login or Register  to view this content.

+ 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. Can't set userform to modeless!
    By fcb1900 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-14-2010, 02:16 PM
  2. Modeless UserForm problem
    By jdelorme in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-14-2009, 02:22 PM
  3. Modeless userform
    By hngo in forum Excel - New Users/Basics
    Replies: 2
    Last Post: 07-13-2005, 05:05 AM
  4. [SOLVED] Modeless userform OLEObject Add problem
    By jjk in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-25-2005, 08:11 PM
  5. [SOLVED] modeless userform during shutdown phase
    By Roland in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-25-2005, 05:06 PM

Tags for this Thread

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