I am working to create it so when the application cannot find the file that the user selected, it will go back to the original form (where it was selected - frmLetters). So I am using a Try, Catch block but it just continues down the sub procedure.
I need it to stop the current sub procedure and go back to the original form for the user to choose the correct file. This is the code I am trying:
Try
objExcelBook = objExcelApp.Workbooks.Open(sInputExcelDataFile,, True)
Catch ex As Exception
MsgBox("Are You Sure you chose the correct file path?")
Me.Close()
frmLetters.Close()
frmLetters.Show()
End Try
I am much more familiar with VBA but the syntax is similar in most cases. I know try, Catch doesn't exist in VBA but if I wanted to return to the original form it is very simple.
Just so you know the reason I am closing frmLetters before opening it, is at this point it is only hidden.