Private Sub Command1_Click() If Dir("d:/test.txt") = "" Then MsgBox "不存在" Else MsgBox "存在" End If End Sub