Private Sub Form_Load()
Dim CheckFile1, CheckFile2 As String
' Check if folder exists, first.
If Dir("c:\version", vbDirectory) = vbNullString Then
Exit Sub
End If
' Check if file exists
CheckFile1 = Dir$("c:\version\version.txt")
CheckFile2 = Dir$("c:\version\versionold.txt")
If CheckFile1 = "version.txt" And CheckFile2 = "versionold.txt" Then
Exit Sub
ElseIf CheckFile1 = "version.txt" Then
Name "c:\version\version.txt" As "c:\version\versionold.txt"
Call CreateFile
End If
End Sub
Are you using VB6, or are you just being taught to use VB.NET as badly as it's possible to use it ? What is Dir ? What is vbNullString ? Use .NET, not VB6 carryover garbage. System.IO contains ALL you need. For example, System.IO.Directory.Exists will tell you if a directory exists.
Replace the c:\ with a variable, and fill that variable by iterating over the available drives using the System.IO namespace.