check whether a file exists

Posted on March 10th, 2009 in Visual Basic by admin

Private Sub Form_Load()

Dim objfso As New FileSystemObject
If objfso.FileExists(”f:test.txt”) Then
MsgBox “The file exists”, vbInformation
Else
MsgBox “The file does not exist”, vbInformation
End If

End Sub

Related posts:

  1. checks whether a drive exists Private Sub Form_Load() Dim objfso As New FileSystemObject If objfso.DriveExists(”h:”)...
  2. check whether you can play audio files Private Declare Function waveOutGetNumDevs Lib “winmm.dll” () As Long Private...
  3. copy a text file Private Sub Form_Load() Dim objfso As New FileSystemObject objfso.CopyFile “D:Test.txt”,...
  4. This program deletes a file Public sub Form_Load() Dim objfso As New FileSystemObject objfso.DeleteFile “D:Test.txt”...
  5. Display a CSV file Display a CSV file CSV files are common formats to...

Related posts brought to you by Yet Another Related Posts Plugin.

Post a comment