Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Capturing an Error
Hi all,
This forum is cool and provides superb suggestions - Welldone!! My current problem: I have included an "INPUTBOX" which gives me the option of inputting search string. The choices offered a OK and CANCEL If I click on CANCEL, the system gives "Runtime error 1004" dialogu box. What I wish to do is: - if the user clicks on CANCEL, then display a message: "Search cancelled by user". - if the user does NOT enter any search string (i.e. leaves it BLANK) but clicks on OK, then, display a message: "Please input a search string" and display the initial INPUTBOX again. Thank you ever so much. CSKG -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Capturing an Error
Sub GetSearchString()
Dim search As String search = Trim(InputBox("Enter Search Text")) If search = "" Then MsgBox "Search Cancelled" Else ' process the search string End If End Sub hitting Cancel or clicking OK without entering any text both result in the retun of an emoty string. So that's your first test. Patrick Molloy Microsoft Excel MVP -----Original Message----- Hi all, This forum is cool and provides superb suggestions - Welldone!! My current problem: I have included an "INPUTBOX" which gives me the option of inputting a search string. The choices offered a OK and CANCEL If I click on CANCEL, the system gives "Runtime error 1004" dialogue box. What I wish to do is: - if the user clicks on CANCEL, then display a message: "Search cancelled by user". - if the user does NOT enter any search string (i.e. leaves it BLANK) but clicks on OK, then, display a message: "Please input a search string" and display the initial INPUTBOX again. Thank you ever so much. CSKGG --- Message posted from http://www.ExcelForum.com/ . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Capturing Top 5 Performers | Excel Worksheet Functions | |||
capturing all of the data | Excel Worksheet Functions | |||
Capturing an error and then ignoring it | Excel Programming | |||
On Error, Capturing current module and actual line of code | Excel Programming | |||
Capturing user name | Excel Programming |