--GO TO BOTTOM OF THIS POST BEFORE READING--
If you're having trouble you can review Uber-banana's
tutorial on this.
If you want to null out any errors you still may be having...
This is how to set specific tasks to perform if the process comes across any erros. At the beginning of the 'Private Sub' put the statement: 'On Error GoTo
errorhandler'
errhandler is just a random name i decided to choose for the 'Goto' label. Your code should look relatively like this now:
Code: Select all
Private Sub cmd1_Click()
On Error GoTo errorhandler
After that you can put the code for the open dialog and whatever else you want. At the end of that code place the line 'Exit Sub'. This will quit the process and ignore everything beyond that line. This means if no errors occurr while the open file dialog is open then it will ignore this next line:
This means that when an error is run upon and it goes to the line defined as 'errorhandler' it will commit the action of 'Exit Sub'.
This is what your final code should look like:
Code: Select all
Private Sub cmd1_Click()
On Error GoTo errorhandler
' (Your code here)
Exit Sub
errorhandler:
Exit Sub
End Sub
Anyways, if you meant an error that Visual Basic was giving you then I just wasted my time. Whatever, you actually probably are, add this right after '.Flags'

I want to kill myself...