Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Input box cancel button to stop macro?

Status
Not open for further replies.

DustoBOE

Technical User
Dec 12, 2013
25
US
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

 
Do I have to create my own dialog box to use the cancel button?
 
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.
 
I'm going to try that with a few upgrades now, Remy988. That is an excellent suggestion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top