+ Reply to Thread
Results 1 to 15 of 15

IsFormLoaded causes the Open File Dialog box to appear!!!

  1. #1
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    IsFormLoaded causes the Open File Dialog box to appear!!!

    Please Login or Register  to view this content.
    The code above is famous - google "how to see if a userform is open" will give numerous answers pointing to the function above.

    The problem is when I run this code:
    Please Login or Register  to view this content.
    and "ImportFilterForm" userform is not open - the File Open Dialog box opens!!! What is wrong and how do I stop the File Open Dialog Box from appearing? Thanks!!

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    Can’t you just check if the form is nothing, this seems like a hacky workaround for not properly instancing the form in the first place

  3. #3
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    I am willing to try anything. What's the code for checking if the form is nothing?

    Is it:
    Please Login or Register  to view this content.
    I'll try anything. Just thought the OP code was the easiest way. Thanks.

  4. #4
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    I just tried
    Please Login or Register  to view this content.
    and it still opens up an Open File dialog box.

  5. #5
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    Do you have any code in the Initialize or Activate event of ImportFilterForm?
    If posting code please use code tags, see here.

  6. #6
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    Yes - the first thing it does is open a File Open dialog box in the Userform_Initialize event. Thanks for helping me identify the problem!!! The thing is: why would the Initialize event trigger? Thanks!

  7. #7
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    For some reason the IsLoaded function, or other code associated with it, is causing the form you are trying to check on to be loaded.

    How/where are you using IsLoaded?

  8. #8
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    I just found out the code in the OP does not in fact work. I tried testing it on Workbook Open event to see if ImportFilterForm is open or not, and it always thinks it's open. I found this alternative code that works properly:
    Please Login or Register  to view this content.
    This is surprising because the code in the OP is repeated in multiple places on the internet and many people said it worked for them, but it flat out does not work.

  9. #9
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    Norie: I did not use it previously. I came across the code in the OP at some time and added it to my list of functions.

    Then I came across a situation to use it (a few days ago), but found it kept opening the File open dialog box.

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    Are you sure this IsLoaded function you wound is intended for Excel userforms?

    I can recall writjing my own version of an IsLoaded function but it was for Access forms/reports and worked slightly differently.

    Note, this was for Access 97 - the latest versions of Access now have an IsLoaded property that can be used for most objects, e.g. forms, reports etc in Access.

  11. #11
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    The second code in post #8 doesn't work either. I read someone else's suggestion that the only way to detect if a userform is open or not, is to set a variable. I think I might do that unless someone can come up with a better solution

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    Why do you want to check is a form is loaded?

  13. #13
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    In order to do this, I want to create a single Integer variable that will determine if any Userform is open.

    If = 1, then ABC open
    if = 10 then CDE open
    If = 100 then FGH open
    so if = 111 then ABC, CDE and FGH is open (etc).

    Is there a mathematical "or" operator for this code to work?

    eg.

    Please Login or Register  to view this content.
    Is there something like that? Thanks.

  14. #14
    Forum Contributor
    Join Date
    10-10-2018
    Location
    Calgary, Canada
    MS-Off Ver
    2016
    Posts
    214

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    Norie: I have generic Message Box forms with progress bars, and I want to dynamically change the message depending on which userform is open, or even if this message form (Called MsgForm) is open.

    For example If IsLoaded(Msgform) then MsgForm.MessageLabel.Caption = "Now running the XYZ step.."

  15. #15
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: IsFormLoaded causes the Open File Dialog box to appear!!!

    Not sure I follow.

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.

+ 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. [SOLVED] Open dialog with all files listed, then the selected file to open
    By Tiger20 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-16-2015, 01:20 AM
  2. VBA Changing a fixed file path with open file dialog box
    By Dan27 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-01-2011, 08:54 AM
  3. VBA for excel 2003. Open file dialog box, open 2007 file xlsx, continue with code
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2011, 12:12 AM
  4. How to get the open file dialog to open to a certain folder
    By tenk283 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2010, 11:54 PM
  5. File Open Dialog Box Open at Set Folder
    By Soltisolti in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-10-2007, 10:05 PM
  6. Macro to open a file open dialog box
    By C C in forum Excel General
    Replies: 2
    Last Post: 08-04-2006, 11:30 PM
  7. File Browse Function (Open dialog box for choosing file)
    By b-123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-25-2005, 06:05 PM

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