G
Graham Standring
I would like to be able to include VBA code in a workbook, which will
automatically send an email message when certain criteria are
satisfied. I do not want to send a copy of a worksheet or workbook or
any other file - I just want to send a standard message to a known
internal email address.
I am using Excel 97 (SR-2) in Windows NT 4 (SP 6a)
Our company uses Netscape Communicator as our email tool. It uses an
IMAP server, (whatever that means). We are not able to send emails
using Outlook.
I have seen the advice from Ron de Bruin on using CDO to send emails,
(http://www.rondebruin.nl/cdo.htm), which does not depend on any
particular email software. Unfortunately this does not work for me. I
assume this is because I am using Windows NT? Any help would be greatly
appreciated.
The code I have is as follows. This Sub is called from another Sub when
the relevant conditions are satisfied. It generates an error at the
line indicated.
Sub Send_email()
Dim iMsg As Object
Dim iConf As Object
Application.ScreenUpdating = False
Set iMsg = CreateObject("CDO.Message") ' Error occurs on this line
Set iConf = CreateObject("CDO.Configuration")
With iMsg
Set .Configuration = iConf
.to = "(e-mail address removed)" ' enter real email address
here
.From = """Facility Centre weekly report generator""
<[email protected]>" ' enter sender's email address
.Subject = "Weekly report differences"
.TextBody = "This is an automatically generated message." &
vbNewLine & vbNewLine & _
"There is at least one difference between" & vbNewLine &_
"this week's report and last week's." & vbNewLine &
vbNewLine & _
"You should open this week's report" & vbNewLine & _
"to view the differences."
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Application.ScreenUpdating = True
End Sub
automatically send an email message when certain criteria are
satisfied. I do not want to send a copy of a worksheet or workbook or
any other file - I just want to send a standard message to a known
internal email address.
I am using Excel 97 (SR-2) in Windows NT 4 (SP 6a)
Our company uses Netscape Communicator as our email tool. It uses an
IMAP server, (whatever that means). We are not able to send emails
using Outlook.
I have seen the advice from Ron de Bruin on using CDO to send emails,
(http://www.rondebruin.nl/cdo.htm), which does not depend on any
particular email software. Unfortunately this does not work for me. I
assume this is because I am using Windows NT? Any help would be greatly
appreciated.
The code I have is as follows. This Sub is called from another Sub when
the relevant conditions are satisfied. It generates an error at the
line indicated.
Sub Send_email()
Dim iMsg As Object
Dim iConf As Object
Application.ScreenUpdating = False
Set iMsg = CreateObject("CDO.Message") ' Error occurs on this line
Set iConf = CreateObject("CDO.Configuration")
With iMsg
Set .Configuration = iConf
.to = "(e-mail address removed)" ' enter real email address
here
.From = """Facility Centre weekly report generator""
<[email protected]>" ' enter sender's email address
.Subject = "Weekly report differences"
.TextBody = "This is an automatically generated message." &
vbNewLine & vbNewLine & _
"There is at least one difference between" & vbNewLine &_
"this week's report and last week's." & vbNewLine &
vbNewLine & _
"You should open this week's report" & vbNewLine & _
"to view the differences."
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
Application.ScreenUpdating = True
End Sub