+ Reply to Thread
Results 1 to 4 of 4

Modal issues when cancelloing exiting a textbox

  1. #1
    Forum Contributor
    Join Date
    12-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    106

    Modal issues when cancelloing exiting a textbox

    HI I have a userform with various textboxes in it. one textbox I want to only contain numbers so I have the following code trigger if a letter is entered
    Please Login or Register  to view this content.
    This works fine when the property of the userform modal is set to true. the current textbox highlights the current text for me to overwrite. the problem is when I switch the userform to modal = false it doesn't work.

    Any ideas why this is and whether there is a simple workaround.

    Also the above code will allow eg 100 to be entered or £100. Is there a way to exclude the £100 being accepted.

    thanks in advance and happy new year

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

    Re: Modal issues when cancelloing exiting a textbox

    Where is this code located within the userform module?
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    12-14-2012
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    106

    Re: Modal issues when cancelloing exiting a textbox

    hi here it is

    Please Login or Register  to view this content.

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

    Re: Modal issues when cancelloing exiting a textbox

    The issue is with form losing focus, which may not be prevented with this method. I suggest you only flag the control as invalid in Exit event (e.g. with red colour) and validate all controls when exiting form/saving data. As an alternative you may use an additional textbox control on this form for data entry messages instead of using message box.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

+ 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. textbox to Cell date format issues
    By Panic in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2008, 03:06 AM
  2. [SOLVED] Run a procedure when exiting a a textbox within a userform
    By borg in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-15-2006, 02:10 AM
  3. [SOLVED] Forms that are modal in 97 are not modal in 2003
    By Old Car in forum Excel General
    Replies: 2
    Last Post: 04-27-2005, 04:06 AM
  4. [SOLVED] Forms that are modal in 97 are not modal in 2003
    By Old Car in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2005, 04:06 AM
  5. Modal Forms
    By MJRay in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-08-2005, 02: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