Checking 2 c if workbook exists

  • Thread starter Thread starter DavidMc
  • Start date Start date
D

DavidMc

I have two spreadsheets, one saved on a floppy disk called
demo.xls and one stored on the c drive called master.xls,
what i would like to do is to get master.xls to check
whether demo.xls exists on the floppy disk. how do i do
this?
 
I get that error if there is no disk in the floppy drive:

dir("A:\*.*")


Sub CheckDemo()
On Error GoTo ErrHandler
tryAgain:
sFile = Dir("A:\demo.xls")
If sFile = "" Then
MsgBox "Put disk with demo.xls in the floppy drive"
End If
Exit Sub
ErrHandler:
If Err.Number = 52 Then
MsgBox "Please put a floppy in the drive and hit enter"
Resume tryAgain
End If
End Sub
 
Back
Top