Problem in where to Use Module to Get it to Work

quest4

Registered User.
Local time
Today, 12:01
Joined
Oct 12, 2004
Messages
246
Good morning, I have a home based computer running XP Pro and Roadrunner Web Mail as the e-mail agent and Outlook is not on the computer. I found a script that says that it can do this, so I put it in a module and tried it but I can not get it to run in that macro, which is run from the switchboard. Could someone please tell me how to get this code working so my wife will be able to e-mail this report to her supervisor instead of calling it in all of the time. Here is the code I am tring to use:
Public Sub Send(recipients As String, from As String, subject As String, smtpServer As String, Optional msg As String, Optional attachPath As String)
On Error GoTo handler
Dim iMsg As New CDO.Message
Dim iConf As New CDO.Configuration
'set up configuration
With iConf
With .fields
.item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp-server"
.item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
.item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAnonymous
.Update
End With
End With
'configure message
With iMsg
Set .Configuration = iConf
.To = "RecpiantE-Mail"
.from = "Sender E-Mail"
.subject = "Daily Transcription Report"
If msg <> "" Then .TextBody = msg
If attachPath <> "" Then .AddAttachment attachPath
.Send
End With
'tidy up
Set iMsg = Nothing
Set iConf = Nothing
Exit Sub
handler:
Err.Raise Err, Err.Source & " - Lib.Mail.Send()"
End Sub
If there is a better way of doing this please let me know, but I have not built any dbases or done any code writing in the last year or two, so I am very rusty on this right now and any help will be greatly appreciated and much thanks in advance to anyone helping me out with this problem.
 

Users who are viewing this thread

Back
Top Bottom