ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   file handling 2 (https://www.excelbanter.com/excel-programming/294311-file-handling-2-a.html)

Jo[_6_]

file handling 2
 
Hi
This is still not working
If the disk is not inserted I get an error message and if
the file is there the msgbox still runs.
Thanks
Jo


Hello Jo,

It is easier to use the Dir command for this

myFile= Dir("A:\*w.xls")
If myFile="" then
MsgBox
Else Workbooks.Open Filename:= "A:\" & myFile

HTH, Greg

"Jo" wrote in message
...
Hi
I would really appreciate if someone could help me with
the below code. I want to see is a file labelled ??????w
ia on the floopy and if it is run openme. If the file is
not there or no disk is inserted then have an error

msgbox.
Thanks
Jo

Sub f()
Dim fs
Set fs = Application.FileSearch
With fs
.LookIn = "A:/"
.filename = "??????w"
If .Execute() 0 Then
open_w
Else
MsgBox "Make sure a disk is inserted and contains a file
labelled ??????w"
End If
End With
End Sub



..



Bob Phillips[_6_]

file handling 2
 
Try my original post

Dim oWb As Workbook

On Error Resume Next
Set oWb = ")
If oWb Is Nothing Then
MsgBox "File not found"
End If
On Error GoTo 0

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Jo" wrote in message
...
Hi
This is still not working
If the disk is not inserted I get an error message and if
the file is there the msgbox still runs.
Thanks
Jo


Hello Jo,

It is easier to use the Dir command for this

myFile= Dir("A:\*w.xls")
If myFile="" then
MsgBox
Else Workbooks.Open Filename:= "A:\" & myFile

HTH, Greg

"Jo" wrote in message
...
Hi
I would really appreciate if someone could help me with
the below code. I want to see is a file labelled ??????w
ia on the floopy and if it is run openme. If the file is
not there or no disk is inserted then have an error

msgbox.
Thanks
Jo

Sub f()
Dim fs
Set fs = Application.FileSearch
With fs
.LookIn = "A:/"
.filename = "??????w"
If .Execute() 0 Then
open_w
Else
MsgBox "Make sure a disk is inserted and contains a file
labelled ??????w"
End If
End With
End Sub



.






All times are GMT +1. The time now is 06:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com