Have the following bit of code which opens an Excel file related to an entry in a form when the user clicks a button:
Private Sub Cmd_OpenExcel_CoreLoc_Click()
Dim CorePath
CorePath = "W:\Core Data\" & Me.WELLNAME.Value & ".xls"
Shell "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE """ & CorePath & "", vbNormalFocus
End Sub
However, if there is no file found Excel still opens and spits out it's own error message.
Is there any way to stop Excel opening if the file doesn't exist and Access giving it's own "not found" type message? I'm sure there is but I have no idea how to go about it.
Would appreciate any help and pointers.
Cheers,
Geezer
Private Sub Cmd_OpenExcel_CoreLoc_Click()
Dim CorePath
CorePath = "W:\Core Data\" & Me.WELLNAME.Value & ".xls"
Shell "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE """ & CorePath & "", vbNormalFocus
End Sub
However, if there is no file found Excel still opens and spits out it's own error message.
Is there any way to stop Excel opening if the file doesn't exist and Access giving it's own "not found" type message? I'm sure there is but I have no idea how to go about it.
Would appreciate any help and pointers.
Cheers,
Geezer