+ Reply to Thread
Results 1 to 11 of 11

modal input method?

  1. #1
    Registered User
    Join Date
    08-17-2012
    Location
    Round Rock, Tx
    MS-Off Ver
    Excel 2010
    Posts
    25

    modal input method?

    Programmers,

    I like the way the input method allows vba to check if the user clicks cancel or clicks 'ok' without any input. However, for my purposes, it is a disadvantage that application.input allows the user to access the workbook (it is modeless). So the question is: is there a way to make the input method modal?

    John

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

    Re: modal input method?

    Just use a VBA InputBox.

  3. #3
    Registered User
    Join Date
    08-17-2012
    Location
    Round Rock, Tx
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: modal input method?

    Quote Originally Posted by Norie View Post
    Just use a VBA InputBox.
    Thanks Norie but the vba inputbox doesn't allow you to tell the difference between user cancels and user 'ok's (without input) while the method lets you differentiate. The input function returns an empty string ("") for both actions. So I was wondering if there was a way to use the method but make it modal? Don't want the user to be able to get to the speadsheet, but do want to be able to tell if cancel or empty string.

    Right now the vba inputbox is it: and, if an MT string then a msgbox " you clicked cancel or clicked 'OK' without entering a date" "Do you want to continue?" vbyesno..code..code..code.

    I was wondering if there was any way to combine the "best" features of both?

    Thanks again for taking the time to reply,

    John

  4. #4
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: modal input method?

    if(StrPtr(Input_Message)=0) then it means user has pressed the cancel button. I think this would help you.

  5. #5
    Registered User
    Join Date
    08-17-2012
    Location
    Round Rock, Tx
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: modal input method?

    Thank you Sinhus, I will try that.
    ***********************
    tried it and it seems to work!

    too tired to continue tonight will let you know in the morning

    John
    Last edited by john/nyc; 11-02-2012 at 01:00 AM.

  6. #6
    Registered User
    Join Date
    08-17-2012
    Location
    Round Rock, Tx
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: modal input method?

    I just read the cross posting rules (on another forum) and the rules here are essentially the same so I disclose that I posted this question here:

    http://www.excelguru.ca/forums/showt...-with-modality

    and here:

    http://www.ozgrid.com/forum/showthre...066#post635066

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

    Re: modal input method?

    The InputBox does allow you to tell if Cancel is pressed.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-17-2012
    Location
    Round Rock, Tx
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: modal input method?

    Quote Originally Posted by Norie View Post
    The InputBox does allow you to tell if Cancel is pressed.
    Please Login or Register  to view this content.
    Norie,

    What would happen if the user clicked 'OK' without entering any input?

    John
    Last edited by john/nyc; 11-02-2012 at 01:12 AM. Reason: tryiong to delete duplicate

  9. #9
    Registered User
    Join Date
    08-17-2012
    Location
    Round Rock, Tx
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: modal input method?

    Quote Originally Posted by Norie View Post
    The InputBox does allow you to tell if Cancel is pressed.
    Please Login or Register  to view this content.
    Norie,

    What would happen if the user clicked 'OK' without entering any input?

    John

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

    Re: modal input method?

    John

    Sorry, you are right that would give the same result.

    It's late here, that's my excuse.

    Try Sindhus' answer - it works.

  11. #11
    Registered User
    Join Date
    08-17-2012
    Location
    Round Rock, Tx
    MS-Off Ver
    Excel 2010
    Posts
    25

    Re: modal input method?

    Quote Originally Posted by Norie View Post
    John

    Sorry, you are right that would give the same result.

    It's late here, that's my excuse.

    Try Sindhus' answer - it works.
    not a problem I'm the beggar here

    john

+ 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