+ Reply to Thread
Results 1 to 4 of 4

does a file exist

  1. #1
    Registered User
    Join Date
    10-24-2003
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    32

    does a file exist

    I would like to make a True/False statement in an excel-formula that checks
    if a certain file exists on the harddisk or not.
    There must be some kind of VBA statement for that.

    Please let me know if you can help me. Thanks.

    Arien de Haan
    Eindhoven, NL

  2. #2
    Bob Phillips
    Guest

    Re: does a file exist

    Best to add a UDF

    Function BookExists(wb As String)
    BookExists = Len(Dir(wb)) > 0
    End Function

    and use like

    =IF(BookExists("C:\myfile.xls"), "yes","no")

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Arien" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I would like to make a True/False statement in an excel-formula that
    > checks
    > if a certain file exists on the harddisk or not.
    > There must be some kind of VBA statement for that.
    >
    > Please let me know if you can help me. Thanks.
    >
    > Arien de Haan
    > Eindhoven, NL
    >
    >
    > --
    > Arien
    > ------------------------------------------------------------------------
    > Arien's Profile:

    http://www.excelforum.com/member.php...fo&userid=1892
    > View this thread: http://www.excelforum.com/showthread...hreadid=497521
    >




  3. #3
    Peter Rooney
    Guest

    RE: does a file exist

    Arien,

    Here's some code I use to delete a dummy file from the C drive - I'm sure
    you can adapt it to your needs.

    Regards & happy New Year

    Pete

    If Dir("C:\Holidays+Training+Sickness Chart.xls") <> "" Then
    Kill "C:\Holidays+Training+Sickness Chart.xls"
    End If

    "Arien" wrote:

    >
    > I would like to make a True/False statement in an excel-formula that
    > checks
    > if a certain file exists on the harddisk or not.
    > There must be some kind of VBA statement for that.
    >
    > Please let me know if you can help me. Thanks.
    >
    > Arien de Haan
    > Eindhoven, NL
    >
    >
    > --
    > Arien
    > ------------------------------------------------------------------------
    > Arien's Profile: http://www.excelforum.com/member.php...fo&userid=1892
    > View this thread: http://www.excelforum.com/showthread...hreadid=497521
    >
    >


  4. #4
    Registered User
    Join Date
    10-24-2003
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    32
    It works. Thanks a lot.
    regards, Arien de Haan



    Quote Originally Posted by Bob Phillips
    Best to add a UDF

    Function BookExists(wb As String)
    BookExists = Len(Dir(wb)) > 0
    End Function

    and use like

    =IF(BookExists("C:\myfile.xls"), "yes","no")

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "Arien" <[email protected]> wrote in message
    news:[email protected]...
    >
    > I would like to make a True/False statement in an excel-formula that
    > checks
    > if a certain file exists on the harddisk or not.
    > There must be some kind of VBA statement for that.
    >
    > Please let me know if you can help me. Thanks.
    >
    > Arien de Haan
    > Eindhoven, NL
    >
    >
    > --
    > Arien
    > ------------------------------------------------------------------------
    > Arien's Profile:

    http://www.excelforum.com/member.php...fo&userid=1892
    > View this thread: http://www.excelforum.com/showthread...hreadid=497521
    >

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1