Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 ", "", _ "ONE OR MORE FILES HAVE NOT BEEN UPDATED: ", "" Else SendEmail ", "", _ "ALL FILES HAVE TODAY'S DATE AS 'LAST SAVE DATE'", "" End If 'Close Microsoft EXCEL Application.Quit End End Sub -- Chuckles123 ------------------------------------------------------------------------ Chuckles123's Profile: http://www.excelforum.com/member.php...o&userid=14948 View this thread: http://www.excelforum.com/showthread...hreadid=565285 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
General mail failure when sending e-mail from Excel | Excel Discussion (Misc queries) | |||
Sending Mail from VBA | Excel Programming | |||
Sending E-mail | Excel Programming | |||
Sending e-mail - Ron, you still there? | Excel Programming |