Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Window Message for not value found

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Window Message for not value found

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Window Message for not value found

Ron;
Thanks for your quick response.
I statement is running very well, however, I donot wher I have to located
into my program because I got the window message all the time.
Could you please tell me where can I located it into my program?

Thanks.\
Maparalia


"Ron de Bruin" wrote:

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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Window Message for not value found

If you have filename.xls in the worksheet cell then use example 2.
If you only have the filename without the extension use example1


Sub Open_xls_File1()

WO = Application.InputBox("Enter Work Order Number")
directory = "C:\Test\Colors\" & WO & "\"
filetext = Selection.Value

If Dir(directory & filetext & ".xls") < "" Then
Workbooks.Open directory & filetext & ".xls"
Else
MsgBox "Wrong"
End If

End Sub


Sub Open_xls_File2()

WO = Application.InputBox("Enter Work Order Number")
directory = "C:\Test\Colors\" & WO & "\"
filetext = Selection.Value

If Dir(directory & filetext) < "" Then
Workbooks.Open directory & filetext
Else
MsgBox "Wrong"
End If

End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl


"maperalia" wrote in message ...
Ron;
Thanks for your quick response.
I statement is running very well, however, I donot wher I have to located
into my program because I got the window message all the time.
Could you please tell me where can I located it into my program?

Thanks.\
Maparalia


"Ron de Bruin" wrote:

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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 258
Default Window Message for not value found

Thanks you very much Ron it is working PERFECTLY!!!!!.

Best regards
Maperalia

"Ron de Bruin" wrote:

If you have filename.xls in the worksheet cell then use example 2.
If you only have the filename without the extension use example1


Sub Open_xls_File1()

WO = Application.InputBox("Enter Work Order Number")
directory = "C:\Test\Colors\" & WO & "\"
filetext = Selection.Value

If Dir(directory & filetext & ".xls") < "" Then
Workbooks.Open directory & filetext & ".xls"
Else
MsgBox "Wrong"
End If

End Sub


Sub Open_xls_File2()

WO = Application.InputBox("Enter Work Order Number")
directory = "C:\Test\Colors\" & WO & "\"
filetext = Selection.Value

If Dir(directory & filetext) < "" Then
Workbooks.Open directory & filetext
Else
MsgBox "Wrong"
End If

End Sub

--
Regards Ron de Bruin
http://www.rondebruin.nl


"maperalia" wrote in message ...
Ron;
Thanks for your quick response.
I statement is running very well, however, I donot wher I have to located
into my program because I got the window message all the time.
Could you please tell me where can I located it into my program?

Thanks.\
Maparalia


"Ron de Bruin" wrote:

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







Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error message refers to Name that can't be found RealGomer Excel Discussion (Misc queries) 1 January 20th 10 07:17 PM
The message EUROTOOL.XLA!fshow TTO Dialog cannot be found Distraught User Excel Discussion (Misc queries) 0 July 23rd 07 12:06 PM
Style 'Percent' not found error message. DanG Excel Discussion (Misc queries) 2 April 10th 07 03:36 AM
Getting the message: Style 'currency' not found RJP at NYU Excel Discussion (Misc queries) 1 May 19th 06 02:29 PM
If not found get a message Fgomez Excel Programming 2 March 16th 05 10:28 PM


All times are GMT +1. The time now is 12:40 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"