Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I'm using a routine to run thru a list of files and open them to modif
certain things. here is the chunk of code that open uo the file and activates it Workbooks.Open WindowName Windows(WindowName + ".xls").Activate how can check to see if a file exist before I attempt to open it? the minute it hist the first line,if the file does not exist..i crashes. I need to be able to check first to be able to handle non existin files. thanks Pab -- Message posted from http://www.ExcelForum.com |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Use DIR command
Several examples =============== sPath$ = ThisWorkbook.Path & "\Data" sFname$ = "Data.xls" sFile$ = sPath & "\" & sFname If Dir(sPath, vbDirectory) = "" Then MkDir (sPath) End If =============== If Dir(sFile) = "" Then Exit Sub End If =================== sDir = Dir(sPath & "\*.*") Do If sDir = "" Then Exit Do End If more code here sDir = Dir ' gets the next file Loo -- Message posted from http://www.ExcelForum.com |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
John Walkenbach has some good functions at:
http://j-walk.com/ss/excel/tips/tip54.htm#func1 hth, Doug "pabs " wrote in message ... I'm using a routine to run thru a list of files and open them to modify certain things. here is the chunk of code that open uo the file and activates it Workbooks.Open WindowName Windows(WindowName + ".xls").Activate how can check to see if a file exist before I attempt to open it? the minute it hist the first line,if the file does not exist..it crashes. I need to be able to check first to be able to handle non existing files. thanks Pabs --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
file format or file extension is not valid...error message | Excel Discussion (Misc queries) | |||
Formula to check against a list of valid values | Excel Worksheet Functions | |||
How to check valid Date value? | Excel Worksheet Functions | |||
Frequently used file suddenly becomes 'not a valid file name' | Excel Worksheet Functions | |||
Algorithim to generate/check valid serial keys | Excel Programming |