ItalianPlatinum
Well-known Member
- Joined
- Mar 23, 2017
- Messages
- 771
- Office Version
- 365
- 2019
- Platform
- Windows
Hello,
Having issues on my VBA and couldn't seem to find anything on here that covers both of my issues. I got my VBA to error if no file with message (with below code) or proceed if their is a file (removing code). But i cant get it to do both. If no file stop and show me a error box and then the second proceed if their is a file. My code is MUCH LARGER before and after so if a file exists i need it to run further.
Dim FilePath As String
Dim TestStr As String
FilePath = "MY FILE PATH"
TestStr = ""
On Error Resume Next
TestStr = Dir("MY FILE PATH")
If TestStr = "" Then
MsgBox "File doesn't exist"
On Error GoTo -1
End If
Exit Sub
Thanks in advance for any help
Having issues on my VBA and couldn't seem to find anything on here that covers both of my issues. I got my VBA to error if no file with message (with below code) or proceed if their is a file (removing code). But i cant get it to do both. If no file stop and show me a error box and then the second proceed if their is a file. My code is MUCH LARGER before and after so if a file exists i need it to run further.
Dim FilePath As String
Dim TestStr As String
FilePath = "MY FILE PATH"
TestStr = ""
On Error Resume Next
TestStr = Dir("MY FILE PATH")
If TestStr = "" Then
MsgBox "File doesn't exist"
On Error GoTo -1
End If
Exit Sub
Thanks in advance for any help