ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Checking 2 c if workbook exists (https://www.excelbanter.com/excel-programming/276169-checking-2-c-if-workbook-exists.html)

DavidMc

Checking 2 c if workbook exists
 
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?

Tom Ogilvy

Checking 2 c if workbook exists
 
if dir("A:\demo.xls")<"" then
' file exists
else
' file does not exist
End if

--
Regards,
Tom Ogilvy

"DavidMc" wrote in message
...
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?




DavidMc[_2_]

Checking 2 c if workbook exists
 
Crashes out with Runtime error 52: bad filename or number.


-----Original Message-----
David,

Use Dir. For instance

If Len(Dir("C:\WINDOWS\WIN.INI")) 0 Then
MsgBox "Found"
End If


--

HTH

Bob Phillips

"DavidMc" wrote in message
...
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?



.


Bob Phillips[_5_]

Checking 2 c if workbook exists
 
David,

It's OK for me (XP2002, XL2000). Did you copy it or type it afresh?

--

HTH

Bob Phillips

"DavidMc" wrote in message
...
Crashes out with Runtime error 52: bad filename or number.


-----Original Message-----
David,

Use Dir. For instance

If Len(Dir("C:\WINDOWS\WIN.INI")) 0 Then
MsgBox "Found"
End If


--

HTH

Bob Phillips

"DavidMc" wrote in message
...
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?



.




Tom Ogilvy

Checking 2 c if workbook exists
 
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


--
Regards,
Tom Ogilvy


"DavidMc" wrote in message
...
Crashes out with Runtime error 52: bad filename or number.


-----Original Message-----
David,

Use Dir. For instance

If Len(Dir("C:\WINDOWS\WIN.INI")) 0 Then
MsgBox "Found"
End If


--

HTH

Bob Phillips

"DavidMc" wrote in message
...
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?



.





All times are GMT +1. The time now is 01:22 AM.

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