Cancel action

A

an

In command button I have:

Dim strMsg As String
Dim strInput As String
Dim strDir As String

strInput = InputBox(Prompt:=strMsg, ...)
strDir = "\...\...\"
Shell "C:\Program Files\...\... " & strDir & strInput,
vbMaximizedFocus

Where and what is possible to insert order for to cancel
operation without to execute the last line: Shell...

Thanks in advance
an
 
J

Jim Allensworth

In command button I have:

Dim strMsg As String
Dim strInput As String
Dim strDir As String

strInput = InputBox(Prompt:=strMsg, ...)
strDir = "\...\...\"
Shell "C:\Program Files\...\... " & strDir & strInput,
vbMaximizedFocus

Where and what is possible to insert order for to cancel
operation without to execute the last line: Shell...

Thanks in advance
an

Use Exit.

strInput = InputBox(Prompt:=strMsg, ...)
strDir = "\...\...\"
If [some condition is met] Then
Exit [Sub or Function - whichever it is]
End if
Shell "C:\Program Files\...\... " & strDir & strInput,

- Jim
 
A

an

Thanks Jim.

For your reply and your solution.
Work fine!

an
-----Original Message-----
In command button I have:

Dim strMsg As String
Dim strInput As String
Dim strDir As String

strInput = InputBox(Prompt:=strMsg, ...)
strDir = "\...\...\"
Shell "C:\Program Files\...\... " & strDir & strInput,
vbMaximizedFocus

Where and what is possible to insert order for to cancel
operation without to execute the last line: Shell...

Thanks in advance
an

Use Exit.

strInput = InputBox(Prompt:=strMsg, ...)
strDir = "\...\...\"
If [some condition is met] Then
Exit [Sub or Function - whichever it is]
End if
Shell "C:\Program Files\...\... " & strDir & strInput,

- Jim
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top