×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Input box cancel button to stop macro?

Input box cancel button to stop macro?

Input box cancel button to stop macro?

(OP)
How do I program the Cancel button on an input box to stop the macro that the input box is a part of. Below I have two input boxes, and I'd like the macro to stop anytime the cancel buttin is pressed.


sess0.screen.moveto 21,3
sess0.screen.sendkeys("<Tab>audme")
msgtext = "Input the Audit Case Number"
strCaseNumber=InputBox$(msgtext) 'assigns a value to strCaseNumber
sess0.screen.sendkeys strCaseNumber
sess0.screen.sendkeys ("<enter>")
Sess0.Screen.WaitHostQuiet (g_HostSettleTime)
msgtext = "Input the DATE as DDMMYY"
strDate=InputBox$(msgtext) 'assigns a value to strDate
sess0.screen.moveto 07,02
Sess0.Screen.Sendkeys "COMPLETD"

' sess0.screen.moveto 07,40
Sess0.Screen.Sendkeys strDate

Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
Sess0.Screen.Sendkeys("<Enter>")
Sess0.Screen.WaitHostQuiet(g_HostSettleTime)
sess0.screen.sendkeys("<PF9>")
System.TimeoutValue = OldSystemTimeout
End Sub

RE: Input box cancel button to stop macro?

(OP)
Do I have to create my own dialog box to use the cancel button?

RE: Input box cancel button to stop macro?

hi DustoBOE,

the dialog box would be the way to go.

on the flip side, can you perhaps a value for strCaseNumber. if it's blank, then exit sub.

RE: Input box cancel button to stop macro?

(OP)
I'm going to try that with a few upgrades now, Remy988. That is an excellent suggestion.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close