C
Chuckles123
My code is below. It checks each file in a specified folder for the
'last saved date'; if there are any files that do not have the current
date, it sends an e-mail; if all of the files are updated, it sends an
e-mail to that effect. I have a 'SendEmail' subroutine (not shown, but
referred to in my code) that uses 'Microsoft CDO for Windows 2000
Library' as a "Reference"; it sends e-mail from an SMTP Server on our
network.
My question: is there any way to send the value of n (or the
string value of sn) via the e-mail sent? I was thinking about sending
the name(s) of the file(s) that was/were not updated, but that seems
more difficult, and probably not necessary.
Thanks for your assistance.
Chuckles123
Dim Dte As Date, DtePlusTime As Date
Dim sFilename As String, sNotUpdatedFilename As String
Dim sPath As String
Dim n As Integer, sn As String
n = 0
sPath = "\\DATA\BATCH FILE REPORTS\"
sFilename = Dir(sPath)
Do While sFilename <> ""
DtePlusTime = FileDateTime(sPath & sFilename)
Dte = DateValue(DtePlusTime)
If Dte <> Date Then
'THIS FILE WAS NOT UPDATED TODAY
'CURRENTLY, DOING NOTHING WITH VALUE OF sNotUpdatedFilename
sNotUpdatedFilename = sFilename
n = n + 1
'CURRENTLY, DOING NOTHING WITH VALUE OF sn OR n
sn = WorksheetFunction.Text(n, 0)
Else
'DO NOTHING
End If
'SELECT NEXT FILE IN 'sPath'
sFilename = Dir()
Loop
If n > 0 Then
'PARAMETERS: strTo, strCopy, strSub, strText
SendEmail "(e-mail address removed)", "", _
"ONE OR MORE FILES HAVE NOT BEEN UPDATED: ", ""
Else
SendEmail "(e-mail address removed)", "", _
"ALL FILES HAVE TODAY'S DATE AS 'LAST SAVE DATE'", ""
End If
'Close Microsoft EXCEL
Application.Quit
End
End Sub
'last saved date'; if there are any files that do not have the current
date, it sends an e-mail; if all of the files are updated, it sends an
e-mail to that effect. I have a 'SendEmail' subroutine (not shown, but
referred to in my code) that uses 'Microsoft CDO for Windows 2000
Library' as a "Reference"; it sends e-mail from an SMTP Server on our
network.
My question: is there any way to send the value of n (or the
string value of sn) via the e-mail sent? I was thinking about sending
the name(s) of the file(s) that was/were not updated, but that seems
more difficult, and probably not necessary.
Thanks for your assistance.
Chuckles123
Dim Dte As Date, DtePlusTime As Date
Dim sFilename As String, sNotUpdatedFilename As String
Dim sPath As String
Dim n As Integer, sn As String
n = 0
sPath = "\\DATA\BATCH FILE REPORTS\"
sFilename = Dir(sPath)
Do While sFilename <> ""
DtePlusTime = FileDateTime(sPath & sFilename)
Dte = DateValue(DtePlusTime)
If Dte <> Date Then
'THIS FILE WAS NOT UPDATED TODAY
'CURRENTLY, DOING NOTHING WITH VALUE OF sNotUpdatedFilename
sNotUpdatedFilename = sFilename
n = n + 1
'CURRENTLY, DOING NOTHING WITH VALUE OF sn OR n
sn = WorksheetFunction.Text(n, 0)
Else
'DO NOTHING
End If
'SELECT NEXT FILE IN 'sPath'
sFilename = Dir()
Loop
If n > 0 Then
'PARAMETERS: strTo, strCopy, strSub, strText
SendEmail "(e-mail address removed)", "", _
"ONE OR MORE FILES HAVE NOT BEEN UPDATED: ", ""
Else
SendEmail "(e-mail address removed)", "", _
"ALL FILES HAVE TODAY'S DATE AS 'LAST SAVE DATE'", ""
End If
'Close Microsoft EXCEL
Application.Quit
End
End Sub