Hi
I am trying to write a project that will save any
folder to backup if the date created is the same
as today's date.
I started with the code below but when I run the
code strFile is a null string. I was thinking it would
be the first subfolder in the collection that are
saved in the folder Ron Files.
I am trying to write a project that will save any
folder to backup if the date created is the same
as today's date.
I started with the code below but when I run the
code strFile is a null string. I was thinking it would
be the first subfolder in the collection that are
saved in the folder Ron Files.
Code:
VB6
Option Explicit
Private sSRCE As String, sDEST As String
Private sNextFile As String, c As String, MyName As String
Private strFile As String, strPath As String
Private lCount As Long
Private oFSO As Object, folder As Object, subfolders As Object
Private Sub cmdBackup_Click()
Dim i As Integer
sSRCE = "D:\Program Files\Microsoft Visual Studio\VB98\Ron Files"
sDEST = "H:\Backup\Ron Files"
'Count folders
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set folder = oFSO.GetFolder(sSRCE)
Set subfolders = folder.subfolders
lCount = subfolders.Count
'lCount = 197
Do While lCount <> 0
strPath = sSRCE
strFile = Dir(strPath)
'This is where it fails strFile = vbNullString
Loop