+ Reply to Thread
Results 1 to 7 of 7

Userform appears to be locked until I click a list box

  1. #1
    Registered User
    Join Date
    10-29-2012
    Location
    Bedfordshire, England
    MS-Off Ver
    Excel 2003
    Posts
    35

    Userform appears to be locked until I click a list box

    Hi folks, I'm having a bit of an issue with a userform and was hoping for some advice.

    I have a userform with lots of controls on it, one of which is a list box containing all the fault numbers in the spreadsheet. When the user selects a fault number from this list, all the other controls populate with data relating to that fault. This has all been working fine for some time. However, I recently added a new control (DNList in the code below) and that's what's causing me problems.

    I added a listbox which shows software fixes associated with the selected fault and allowed the user to right-click or double-click the new list box in order to bring up more details. These details open in more userforms and all work fine. However, when closing either of the user forms opened from this new list box the main userform appears to be locked. None of the buttons work, the main list box doesn't respond, nothing. If I click in the new list box it seems to unlock everything and the user continues quite happily.

    This is the code for right-clicking the new listbox (the double-click sub is almost identical)

    Please Login or Register  to view this content.
    After the "AddRemoveDN.Show", control should return to the Main form, but it doesn't.
    I've tried to programmatically fix this by adding code after "AddRemoveDN.Show" to
    Set the focus to DNList
    Set the focus to FaultList
    Set the focus to FaultList then back to DNList
    Set the focus to DNList and the using Sendkeys to move Up/Down/Home/End
    Changing the 2 userforms opened from the new listbox to both Modal and NonModal
    Nothing seems to work.


    Any help would be greatly appreciated.

  2. #2
    Registered User
    Join Date
    10-29-2012
    Location
    Bedfordshire, England
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Userform appears to be locked until I click a list box

    I've managed to get around the problem by getting the X,Y coordinates of the mouse when the user clicked the form and then moving the mouse back to those coordinates and clicking after the sub form has closed. It's not ideal but it does work.

    I'd still be interested to know why this is happening if anyone has any ideas.

  3. #3
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Userform appears to be locked until I click a list box

    probably help to see a workbook if possible but how do you close the addremovedn form? do you have code in it that shows the main form again? (you shouldn't)
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  4. #4
    Registered User
    Join Date
    10-29-2012
    Location
    Bedfordshire, England
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Userform appears to be locked until I click a list box

    I just use "Unload Me" to clear the sub form from memory and return to the parent form.

    The workbook is over 2MB so probably a bit big for posting here and the data in it can't be posted anyway.
    I could try to strip out everything apart from the relevant code, and replace the data with dummy data, but that might take a while.

    As I mentioned earlier, I've got a work-around now so it's no longer an issue as far as the users are concerned.
    I just don't like being beaten by a computer

    I'll leave this thread another day or two before marking it solved just in case someone comes up with a proper solution

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Userform appears to be locked until I click a list box

    you can remove all the data-just need the forms. it may be a timing issue-tried using mouse up instead?

  6. #6
    Registered User
    Join Date
    10-29-2012
    Location
    Bedfordshire, England
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Userform appears to be locked until I click a list box

    Thanks Joseph

    I just changed the right-click event to MouseUp instead of down and it cures the problem
    However, double-click still has the problem.

    I'm going to be busy for the next few hours but will see what I can do about the second sub form later.

    Many thanks for the help.

  7. #7
    Registered User
    Join Date
    10-29-2012
    Location
    Bedfordshire, England
    MS-Off Ver
    Excel 2003
    Posts
    35

    Re: Userform appears to be locked until I click a list box

    Played with the code for a couple of hours last night but still couldn't make any progress on the issue after a double-click.
    However, the "Heath Robinson" mouse-click approach covers that and using Mouse Up instead of Mouse Down cured the other one, so I'm going to mark this one solved.
    Thanks for the help.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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