Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Capturing Top 5 Performers Questor Excel Worksheet Functions 5 April 18th 09 11:33 PM
capturing all of the data jimbo Excel Worksheet Functions 7 July 27th 08 06:10 PM
Capturing an error and then ignoring it cskgg Excel Programming 1 July 23rd 04 10:48 AM
On Error, Capturing current module and actual line of code Paul Martin Excel Programming 4 June 13th 04 06:21 AM
Capturing user name Syed Faisal[_2_] Excel Programming 4 November 18th 03 05:59 PM


All times are GMT +1. The time now is 07:31 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"