I'm trying to figure out how I can check to see if my file exists before my macro continues but I'm having difficulties.
Sub Check_To_See_If_File_Exists()
If Dir("C:\Documents and Settings\Trag\Desktop\Test.xls") = "" Then
MsgBox(vbOKOnly, "NO FILE EXISTS")
End
End If
Workbooks.Open Filename:="C:\Documents and Settings\Trag\Desktop\Test.xls"
'The rest of my macro goes here...
End Sub
Could someone be so kind to tell me where I'm going wrong? I'm a little lost but I've tried.
I need to have my marco check to see if the file exists before it can go on. If it can't go one, msgbox "No file Exists", macro stops.
Sub Check_To_See_If_File_Exists()
If Dir("C:\Documents and Settings\Trag\Desktop\Test.xls") = "" Then
MsgBox(vbOKOnly, "NO FILE EXISTS")
End
End If
Workbooks.Open Filename:="C:\Documents and Settings\Trag\Desktop\Test.xls"
'The rest of my macro goes here...
End Sub
Could someone be so kind to tell me where I'm going wrong? I'm a little lost but I've tried.
I need to have my marco check to see if the file exists before it can go on. If it can't go one, msgbox "No file Exists", macro stops.