+ Reply to Thread
Results 1 to 7 of 7

Inputbox button control + msgbox for empty inputbox

  1. #1
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Inputbox button control + msgbox for empty inputbox

    Hello.

    Somethink that seam so simple in my head is turning out to be a pain in the butt.

    I have the inputbox so i can set a string value,
    When the inputbox Cancle button is pressed i want to exit sub,
    If the inputbox value is nothink and ok button, I want the msgbox displayed then goto newname.
    If the inputbox has a value do >>>>>>That>>>>>

    Please Login or Register  to view this content.
    Thankyou.
    Last edited by D_Rennie; 06-30-2009 at 11:50 AM.

  2. #2
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Inputbox button control + msgbox for empty inputbox

    Use Application.Inputbox with the Type:=2 argument. If it returns "", then the box was left empty and OK was pressed. If Cancel was pressed it returns False.
    Remember what the dormouse said
    Feed your head

  3. #3
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Inputbox button control + msgbox for empty inputbox

    Thankyou for the help.

    I feel as if im missing somethink, If the listbox has a value and cancle is pressed it returning "value"

    Please Login or Register  to view this content.
    Thankyou

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Inputbox button control + msgbox for empty inputbox

    Which version of Excel are you using? In 2003 I get False, even if data was entered (or just the default was left)
    I assume you meant InputBox not Listbox.

  5. #5
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Inputbox button control + msgbox for empty inputbox

    It returns values fine.
    I had strName as string and has troubles
    put strName as variant and it seams fine.

    Does that sound about right to use variant?

    it was puzzling me as it was returning false into the listbox.additem and with the debug thing said "value"

  6. #6
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Inputbox button control + msgbox for empty inputbox

    Variant is better though it should have simply coerced the False into "False" for you.

  7. #7
    Valued Forum Contributor
    Join Date
    05-14-2009
    Location
    gold coast
    MS-Off Ver
    Excel 2007
    Posts
    843

    Re: Inputbox button control + msgbox for empty inputbox

    I dont know much about it though is it when somethink is stored is a string false means like the word "letters" false. though when stored as a variant it means geek speak false.
    Please dont get me to explain geek speak false. Only way to explain it would be with microsoft sam recording.

+ 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