+ Reply to Thread
Results 1 to 3 of 3

check if file exists

  1. #1
    Curt
    Guest

    check if file exists

    Need help vba code to take input from save as dia box check if that file
    exists if does reject that filename. then ask for diff name.

  2. #2
    Steve
    Guest

    Re: check if file exists

    this should get you started:

    Function FileExists(fName) As Boolean
    ' True if exists
    On Error GoTo FileExists_Error

    FileExists = False

    Dim x As String
    x = Dir(fName)
    If x <> "" Then FileExists = True

    Exit Function

    FileExists_Error:
    Select Case Err.Number
    Case 52
    FileExists = False
    Case Else
    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
    procedure FileExists "
    End Select
    End Function


    "Curt" <[email protected]> wrote in message
    news:[email protected]...
    > Need help vba code to take input from save as dia box check if that file
    > exists if does reject that filename. then ask for diff name.




  3. #3
    Curt
    Guest

    Re: check if file exists

    Thanks much will get at it

    "Steve" wrote:

    > this should get you started:
    >
    > Function FileExists(fName) As Boolean
    > ' True if exists
    > On Error GoTo FileExists_Error
    >
    > FileExists = False
    >
    > Dim x As String
    > x = Dir(fName)
    > If x <> "" Then FileExists = True
    >
    > Exit Function
    >
    > FileExists_Error:
    > Select Case Err.Number
    > Case 52
    > FileExists = False
    > Case Else
    > MsgBox "Error " & Err.Number & " (" & Err.Description & ") in
    > procedure FileExists "
    > End Select
    > End Function
    >
    >
    > "Curt" <[email protected]> wrote in message
    > news:[email protected]...
    > > Need help vba code to take input from save as dia box check if that file
    > > exists if does reject that filename. then ask for diff name.

    >
    >
    >


+ 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