Results 1 to 2 of 2

Returning character if file is in a directory

This is a discussion on Returning character if file is in a directory within the Excel Questions forums, part of the Question Forums category; I am trying to convert a Lotus 123 function into an excel fomula. In Lotus a fuction "@isfile" will go ...

  1. #1
    New Member
    Join Date
    Nov 2003
    Posts
    1

    Default Returning character if file is in a directory

    I am trying to convert a Lotus 123 function into an excel fomula. In Lotus a fuction "@isfile" will go into another directory and determine if a file is there and return a code. Is this a way that this can be accomplished in excel?

    Again, this is the requirement. I want to have a formula or function that will go into another directory and determine if a pre-defined file is locted there and return a character or code to the cell. It only needs to do this when the file is opened.

    Thank You

    John
    jcdowning@comcast.net

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209

    Default

    Hi John, welcome to the board

    Here is one way.....

    Code:
    Function IsFile(strFilePath As String) As String
    
    application.volitile
    If Len(Dir(strFilePath)) = 0 Then
        IsFile = "Whatever"
    Else
        IsFile = "File present"
    End If
    
    End Function
    so in a cell formula would be

    =IsFile("c:\a\test.xls")
    Kind Regards,
    Ivan F Moala From the City of Sails

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
  •  


DMCA.com