Home |
Search |
Today's Posts |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
MANY THANKS
"Norman Jones" wrote: Hi Catalin, Try: '============= Sub Testit() Dim blExists As Boolean blExists = FileExists("C:\MyFolder\", "aBook.xls") End Sub '<<============= --- Regards, Norman "Catalin" wrote in message ... many thanks. it does work, but I've got another question: as the message box returns true or false how can I pass this result to a variable? "Norman Jones" wrote: Hi Catalin, Try: '============= Public Function FileExists(sPath As String, _ Optional sFName As String) As Boolean FileExists = Len(Dir(sPath & sFName)) 0 End Function '<<============= An example of usage might be: '============= Sub TestIt() MsgBox FileExists("C:\MyFolder\", "aBook.xls") End Sub '<<============= --- Regards, Norman "Catalin" wrote in message ... Hi all. How do I check in VBA Excel the existence of a specified file in a specified directory and display its status. Thanks |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Check for existence | Excel Discussion (Misc queries) | |||
How do I check for existence of a worksheet? | Excel Worksheet Functions | |||
Test for file existence | Excel Programming | |||
Test for file existence | Excel Programming | |||
Code to check existence | Excel Programming |