Page 1 of 2 12 LastLast
Results 1 to 10 of 17

Forms runtime error 2110

This is a discussion on Forms runtime error 2110 within the Excel Questions forums, part of the Question Forums category; I have a form that has three tabs - a checkbook tab, a budget tab and a balance tab. If ...

  1. #1
    New Member
    Join Date
    Sep 2009
    Posts
    15

    Default Forms runtime error 2110

    I have a form that has three tabs - a checkbook tab, a budget tab and a balance tab. If I edit the code for the balance tab (the last in the group) and then run the form I get a "runtime error 2110 can't move focus to the control because it is invisible, not enabled or of the type that does not accept the focus." If I go back and edit the form and click on the checkbook tab (the first tab in the group) and then exit the debugger and run the form it works fine. What can I change in order for this to work regardless of which tab I have active when I leave the vba debug?
    The code is:
    Sub CheckBookForm()
    Application.WindowState = xlMinimized
    TestUserForm.Show False
    End Sub
    It errors on "testuserform.show false"

    Thanks for the help!

  2. #2
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling
    Posts
    65,831

    Default Re: Forms runtime error 2110

    Goto Tools>Options... and on the General tab select Break On All Errors.

    Now when you get the error hit debug and you should be directed to the offending line of code.
    If posting code please use code tags.

  3. #3
    New Member
    Join Date
    Sep 2009
    Posts
    15

    Default Re: Forms runtime error 2110

    This is already set and the highlighted part of the code that errored is:

    TestUserForm.Show False

    Thanks for the reply!

  4. #4
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling
    Posts
    65,831

    Default Re: Forms runtime error 2110

    Well I don't quite understand that.

    Normally when you get such an error and the Show code is highlighted it means the problem lies in whatever code is triggered when you show the form.

    And normally by setting the option I suggested the Debugger will take you to the problem code.

    The only other thing I can think of is why are you using False?

    Do you actually want to show the userform as modeless?
    If posting code please use code tags.

  5. #5
    New Member
    Join Date
    Sep 2009
    Posts
    15

    Default Re: Forms runtime error 2110

    I tried it as "true" but with no luck. I don't remember why I used "false." At the time it seemed the thing to do. (I'm new at this.) Again, I can get around the error by going back into debug and click on the checkbook tab (the first tab) and then the macro runs fine. More than anything, it's a curious thing that I'd like to get an answer for - but the macro does work. What is a modeless form and how would I make it otherwise?

  6. #6
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling
    Posts
    65,831

    Default Re: Forms runtime error 2110

    Don't use True or False.

    You would normally only use a modeless form if you wanted to display a form and also still be able to work with the workbook/sheet.

    I don't quite know how to describe it technically but it just sort of means that the form doesn't have exclusive focus.

    As for the error, it's hard to tell what the problem is without more information eg code etc.
    If posting code please use code tags.

  7. #7
    New Member
    Join Date
    Sep 2009
    Posts
    15

    Default Re: Forms runtime error 2110

    That prompts my memory - I think I set it to modeless because the form automatically opens when I open the spreadsheet - without modeless, if the form errored, I wouldn't be able to get into my spreadsheet.

    The below is all there is to the code:

    Sub CheckBookForm()
    Application.WindowState = xlMinimized
    TestUserForm.Show False
    End Sub

  8. #8
    Board Regular Norie's Avatar
    Join Date
    Apr 2004
    Location
    Stirling
    Posts
    65,831

    Default Re: Forms runtime error 2110

    So there's no code in the userform module?
    If posting code please use code tags.

  9. #9
    Board Regular jim may's Avatar
    Join Date
    Jul 2004
    Location
    Roanoke, VA
    Posts
    6,299

    Default Re: Forms runtime error 2110

    Change your offending line to

    TestUserForm.Show vbModeless

    From VBA Help
    Constant Value Decription
    vbModeless 0 UserForm is modeless.
    vbModal 1 UserForm is modal (default).
    To display your spreadsheet data use either MrExcel HTML Maker or Excel Jeanie

  10. #10
    Board Regular jim may's Avatar
    Join Date
    Jul 2004
    Location
    Roanoke, VA
    Posts
    6,299

    Default Re: Forms runtime error 2110

    Application.WindowState = xlMinimized << Looks Stranger?? Seems like this is minimizing the Window before Showing the Forms -- Seems like a contradiction
    Comment out the line Application.WindowState = xlMinimized and run code again.
    To display your spreadsheet data use either MrExcel HTML Maker or Excel Jeanie

Page 1 of 2 12 LastLast

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
  •  


DMCA.com