How can I determine if a file exists in a given directory?
On Error GoTo Hell Hell: Kill Me Food For Thought: - Do not judge a book... if you're not a judge!
use the DIR function.. explantion in VB help
(Microsoft MVP from July 2007 to June 2017) . . . . . . . . . . Hitchhiker's Guide to Getting Help at VBForums Database Development FAQs/Tutorials (updated May 2011) (includes fixing common DB related errors, and [VB.Net] ADO.Net Tutorial, and [Classic VB] ADO tutorial /further steps) other useful DB bits: . Connection strings (alternative copy).•. MDAC/Jet/ACE downloads .•. SQL Server downloads . Classic VB FAQs (updated Oct 2010) (includes fixing common VB errors) some of my Classic VB bits: . Tutorial: How to automate Excel from VB6 (or VB5/VBA) .•. SQL 'Select' statement formatter/checker .•. Convert colour number to colour name .•. FlexGrid: fill from recordset .•. FlexGrid: AutoSize columns .•. DB Reserved Words checker .
I dont have MSDN, can you pls show the code here?
VB Code: Dim fso as fileSystemObject msgbox fso.fileExists("C:\whateverfile.whatever") You need a reference from your project to Microsoft Scripting Runtime library.
Dim fso as fileSystemObject msgbox fso.fileExists("C:\whateverfile.whatever")
Last edited by skald2k; Oct 15th, 2002 at 06:11 AM.
- If at first you dont succeed, then give up, cause you will never will!
Originally posted by eimroda I dont have MSDN, can you pls show the code here? You don't need MSDN, just standard VB help files.. If Dir ("c:\windows\test.txt") <> "" Then 'It Exists Else 'It doesn't End If
Thank you skald2k! I'll give your code a try...
VB Code: If Dir$([i]path[/i]) <> "" Then 'The File Exists Else 'The File Does Not Exist End If
If Dir$([i]path[/i]) <> "" Then 'The File Exists Else 'The File Does Not Exist End If
Luke
Thank you all guys! I got it!!!!
No prob
Forum Rules