解决方案 »

  1.   

    Private Sub Command1_Click()
      If Dir(IIf(Right(App.Path, 1) <> "\", App.Path & "\", App.Path & "\") & "T.txt") <> "" Then
        MsgBox "不存在文件"
      Else
        MsgBox "存在文件"
      End If
    End Sub
      

  2.   

    昏,不存在文件和存在文件写反了!修改一下吧。
    Private Sub Command1_Click()
      If Dir(IIf(Right(App.Path, 1) <> "\", App.Path & "\", App.Path & "\") & "T.txt") = "" Then
        MsgBox "不存在文件"
      Else
        MsgBox "存在文件"
      End If
    End Sub
      

  3.   

    Dim oFSO As New Scripting.FileSystemObject
    If oFSO.FileExists(App.Path & "\text1.txt") Then
       msgbox "存在"         
    Else
       msgbox "不存在"           
    endif
      

  4.   

    if dir("c:\t.txt")<>"" then
      msgbox "文件存在"
    endif
    if dir(app.path & "\t.txt")<>"" then
      msgbox "文件存在"
    endif
      

  5.   

    Private Sub Command1_Click()
      If Dir(IIf(Right(App.Path, 1) <> "\", App.Path & "\", App.Path ) & "T.txt") <> "" Then
        MsgBox "存在文件"
      Else
        MsgBox "不存在文件"
      End If
    End Sub