• Advertisement
Sign in to follow this  

Need Some VB6 Error Code Syntax

This topic is 1424 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What I am trying to do is equivilant to an IfExist in C
I can Create - Append - and Read from a Disk File from with in the Code.
I can Also open an File/Directory (Save IN ....) dialog Box
What I want to do is Have the program check to see if the FILENAME exist prior to overwriting the file with in the code

Share this post


Link to post
Share on other sites
Advertisement

In general, you can do something like:

 

Sub MyFunction()
On Error GoTo FailedToReadFile
    ' Read File Code
On Error GoTo FailedToWriteToFile
    ' Write File Code
ExitMyFunction:
Exit Sub
FailedToReadFile:
    ' Read File Error Handling
    GoTo ExitMyFunction
FailedToWriteToFile:
    ' Write File Error Handling
    GoTo ExitMyFunction
End Sub

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement