LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Sending Variable Via E-Mail


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
General mail failure when sending e-mail from Excel Adrienne Excel Discussion (Misc queries) 5 November 4th 05 12:59 PM
Sending Mail from VBA Bhupinder Rayat Excel Programming 1 October 13th 05 12:42 PM
Sending E-mail CB Hamlyn Excel Programming 5 July 24th 05 11:48 PM
Sending e-mail - Ron, you still there? Steph[_3_] Excel Programming 2 September 22nd 04 12:52 AM


All times are GMT +1. The time now is 12:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"