?
Solved

vb/excel question

Posted on 2003-03-05
3
Medium Priority
?
115 Views
Last Modified: 2010-04-07
i would like to know how to run a boolean operation on whether a file exists in a certain directory.
i know about the method FileExists

object.FileExists(filespec)

i just don't understand what a FileSystemObject is

thanks in advance for your help
0
Comment
Question by:jkenin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 400 total points
ID: 8076449
no need for filesystemobject:

Function FileExists(path as String) as Boolean
   if Dir(path) <> "" then
       FileExists = true
   else
       FileExists = false
   end if
end Function
0
 

Author Comment

by:jkenin
ID: 8076504
actually i was wondering if there was a way to determine if a CERTAIN file was in a certain directory. sorry for the miscommunication.

thanks for the prompt reply!
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 8076890
the above code will do it:

Dim strDir as String
Dim strFile as String

strDir = "C:\my documents\"
strFile = "test.txt"

msgbox FileExists(strDir & strFile)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 15 hours left to enroll

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question