Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
InputBox / VBA question ok = print, cancel = exit | Excel Worksheet Functions | |||
Clean up help | Excel Programming | |||
Inputbox and Application.InputBox | Excel Programming | |||
If a called sub exit, how to the caller exit right away? | Excel Programming | |||
=clean(a1) | Excel Programming |