Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default file handling

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default file handling

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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default file handling

Jo,

Just try to open it and test if it was successful

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
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



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 Handling - Check a file isn't already open before overwritin NDBC Excel Discussion (Misc queries) 4 August 13th 09 08:36 AM
Error handling V. Roe Excel Programming 2 February 27th 04 08:04 PM
Error Handling Todd Excel Programming 1 February 13th 04 11:29 PM
Error handling Tim C Excel Programming 1 October 7th 03 10:00 PM
Error Handling Bill Lunney Excel Programming 0 August 6th 03 11:56 PM


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

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

About Us

"It's about Microsoft Excel"