ERLANDSEN DATA CONSULTING Excel & VBA Tips   Informasjon på norsk / Information in Norwegian

These pages are no longer updated and are only available for archive purposes.

Click here to visit the pages with updated information.

Determine if a workbook exists

The function below can be used to determine if a workbook or another file exists:

Function FileExists(FullFileName As String) As Boolean
' returns TRUE if the file exists
    FileExists = Len(Dir(FullFileName)) > 0
End Function

Example:

If Not FileExists("C:\FolderName\SubFolder\FileName.xls") Then 
    MsgBox "The file doesn't exist!"
Else
    Workbooks.Open "C:\FolderName\SubFolder\FileName.xls"
End If

 

Document last updated 1999-12-20 12:51:17      Printerfriendly version

User comments:
Nisha from NZ wrote (2004-08-17 22:57:14 CET):
Great help!!!!
Good info on VBA Programming. Thank you for ur web site.
Ole P. from Norway wrote (2004-03-18 12:11:40 CET):
Re: Tickertape
It would be possible to create a tickertape-like functionality in Excel, but I can't imagine that anyone would want this as it probably will make their spreadsheets calculate slower :-)
Damian Evans from Wales wrote (2004-03-17 16:47:50 CET):
for Ole
Hi ole,

always read your page iwth interest, got many useful tips on it, keep it up....

one question, is it possible to put a ticker tape type of message in Excel. By this I mean a message that continually scrolls across the screen (an example would be the Marquee screen saver).

Cheers
Ole P. from Norway wrote (2003-09-15 12:29:50 CET):
Re: looking good
Thanks Stephen!
My spoilt "royal pets" are doing just fine... :-)
Stephen Moras from Sharjah, UAE wrote (2003-09-15 09:57:15 CET):
looking good ole! :-)
Hi Ole...

Your site keeps getting better n better..Hows the royal pets doing..
Cheers
Israel from Mexico wrote (2003-09-04 02:46:37 CET):
Thanks
this is the best page.
My name is Israel I'm from mexico thanks for your page

 

Erlandsen Data Consulting     http://www.erlandsendata.no/   
Excel & VBA Tips   Copyright ©1999-2024    Ole P. Erlandsen   All rights reserved
E-mail Contact Address