For what it is worth, attached is the code I recently adapted/created for one of my scripts that creates an Excel file based on an Access DB. This is in the process of automating some of my tasks. Have two servers. One is NT the other is Win2000, and ultimately only Win2000. Just haven't had the time to convert. I do not have Outlook installed. Using an SMTP server on our network for the outbound traffic.
Doug Cranston
Public Function sndfilemsg(argsvalue)
' Emails the report to the assigned personnel
' Set Error Handler
On Error Resume Next
argtst = cint(argsvalue)
If argtst = 0 then
' Send Error Message to System Administrators of Problem Encountered
' If used on WIN2 Server/WS remove the double ''
' and then comment out the CDONTS
' Sending a text email using a CDOSYS not CDONTS
Set oMessage = CreateObject("CDO.Message"
oMessage.From = "youremail@somewhere.com"
oMessage.To = "youremail@somewhere.com"
oMessage.Subject = "Report Requests: "
oMessage.AddAttachment "c:\cmdfiles\tempfile\outit.xls"
oMessage.TextBody = "The attached Excel file contains last months Requests Summary." & VbCrLf
oMessage.Configuration.Fields.Item _
("
= 2
oMessage.Configuration.Fields.Item _
("
= _
"smtp.tel.gte.com"
oMessage.Configuration.Fields.Item _
("
= 25
oMessage.Configuration.Fields.Update
oMessage.Send
Set oMessage=Nothing
' CDONTS email for NT
' If using CDONTS remove double single quotes and comment out CDOSYS lines
'' set oMessage = CreateObject("CDONTS.NewMail"
'' oMessage.Subject = "Report Requests"
'' oMessage.From = "youremail@somewhere.com"
'' oMessage.To = "youremail@somewhere.com"
'' oMessage.Cc = "youremail@somewhere.com"
'' oMessage.AttachFile("c:\cmdfiles\tempfile\outit.xls"

'' oMessage.Body = "The attached Excel file contains last months Requests Summary." & VbCrLf
'' oMessage.Send
'' set oMessage=nothing
End if
'Test for Error
If Err.Number <> 0 then
strErrCd = "Creating Email distribution process failed."
call LogErrors(Err, strErrCd)
wscript.quit(1)
End if
End Function