by Jessy Butzke (11 Submissions)
Category: Files/File Controls/Input/Output
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 6th August 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Very simple way to check/copy a file
Dim fso
Dim strFile As String
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists("c:\windows\Calc.exe") Then
FileCopy "c:\windows\Calc.exe", "c:\windows\desktop\Calc.exe"
MsgBox "The program Calc.exe has been copied to your desktop. You can edit the file paths in the code to run how you want it to.", vbInformation, "Notice"
Else
MsgBox "The file you are trying to copy does not exist.", vbCritical, "Error"
End If
End Sub