Try this
If Dir(directory & filetext & ".xls") < "" Then
Workbooks.Open directory & filetext & ".xls"
Else
MsgBox "Wrong"
End If
Maybe without the .xls part ?
--
Regards Ron de Bruin
http://www.rondebruin.nl
"maperalia" wrote in message ...
I have a program that open an excel file from select cell by asking the work
order number (see below). What statement do I need to get a window message
when I type the wrong work order number?.
Thanks in advance.
Maperalia
Sub Open_xls_File()
WO = Application.InputBox("Enter Work Order Number")
directory = "C:\Test\Colors\" & WO & "\"
filetext = Selection.Value
Workbooks.Open directory & filetext
End Sub