![]() |
Clean Exit from InputBox
Is there a way to cleanly exit an InputBox if you select the CANCEL button? Ideally, I would just like to have the user start over again. When I select CANCEL I get a Run Time error, Type mismatch. Below is the InputBox code I have in my macro (it is the first thing a user sees when the macro is launced): Code: -------------------- NumFiles = InputBox("Enter number of files" & Chr(13) & Chr(13) & "Select ALL files in dialog box" & Chr(13) & Chr(13) & "When File|Open dialog box is displayed," & Chr(13) & "Click, Ctrl-Click or Shift-Click to select files", "Files", "", 3500, 3000) -------------------- -- scantor145 ------------------------------------------------------------------------ scantor145's Profile: http://www.excelforum.com/member.php...o&userid=14766 View this thread: http://www.excelforum.com/showthread...hreadid=552632 |
Clean Exit from InputBox
Dim NumFiles as Long
Dim sAns as String sAns = InputBox("Enter number of files" & Chr(13) & Chr(13) & "Select ALL files in dialog box" & Chr(13) & Chr(13) & "When File|Open dialog box is displayed," & Chr(13) & "Click, Ctrl-Click or Shift-Click to select files", "Files", "", 3500, 3000) if sAns = "" then exit sub NumFiles = clng(sAns) -- Regards, Tom Ogilvy "scantor145" wrote: Is there a way to cleanly exit an InputBox if you select the CANCEL button? Ideally, I would just like to have the user start over again. When I select CANCEL I get a Run Time error, Type mismatch. Below is the InputBox code I have in my macro (it is the first thing a user sees when the macro is launced): Code: -------------------- NumFiles = InputBox("Enter number of files" & Chr(13) & Chr(13) & "Select ALL files in dialog box" & Chr(13) & Chr(13) & "When File|Open dialog box is displayed," & Chr(13) & "Click, Ctrl-Click or Shift-Click to select files", "Files", "", 3500, 3000) -------------------- -- scantor145 ------------------------------------------------------------------------ scantor145's Profile: http://www.excelforum.com/member.php...o&userid=14766 View this thread: http://www.excelforum.com/showthread...hreadid=552632 |
All times are GMT +1. The time now is 03:01 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com