PDA

View Full Version : Error Handling: Complete exit



kerl
09-24-2007, 11:19 AM
Hi all,

I'm using the following code to get the filename from the user. In case the filename is blank, I need the code to not only exit that particular sub but the entire vba thing - in other words, I need to completely stop processing, informing the user to run it again.

Any hints will be appreciated!

'Show the open dialog and pass the selected _
file name to the String variable "sFileName"
sFileName = Application.GetOpenFilename
'They have cancelled.
If sFileName = "False" Then Exit Sub

Norie
09-24-2007, 11:33 AM
Try End.

rory
09-24-2007, 03:13 PM
I'd restructure your code. If it's that important, it should be in your main procedure.

kerl
09-24-2007, 03:48 PM
I'd restructure your code. If it's that important, it should be in your main procedure.

Thanks both!

It seems using "end" serves the purpose for right now :)