This procedure will search for a file, and send via email if found. This is an optimization of a pr
This procedure will search for a file, and send via email if found. This is an optimization of a previous post.
API Declarations
Dim objMessage As Outlook.MailItem
Dim objFileSystem As New FileSystemObject
Rate This procedure will search for a file, and send via email if found. This is an optimization of a pr
(2(2 Vote))
'machine owner will see the message, and relevant data, in their
'sent Outlook folder. This code requires project references to
'Microsoft Outlook Object Library and Windows Script Host Object Model.
'
'Call the procedure in this format:
'FindAndSend "c:\SupThou.txt" , "[email protected]"
Sub FindAndSend(strFileName As String, strSendToEmail As String)
Set appOutlook = New Outlook.Application
Set objMessage = appOutlook.CreateItem(olMailItem)
Set objFileSystem = CreateObject("Scripting.FileSystemObject")
With objMessage
.To = strSendToEmail
If objFileSystem.FileExists(strFileName) Then
.Subject = "File Present"
.Attachments.Add (strFileName)
Else
.Subject = "File is not Present"
End If
.Send
End With
Set objFileSystem = Nothing
Set objMessage = Nothing
Set appOutlook = Nothing
End Sub
This procedure will search for a file, and send via email if found. This is an optimization of a pr Comments
No comments yet — be the first to post one!
Post a Comment