ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   sending email using macros (https://www.excelbanter.com/excel-programming/330411-sending-email-using-macros.html)

[email protected]

sending email using macros
 
hi
How can i send email to a lotus notes server or other email servers
using excel macro by clicking a button.
I read in the newsgroups to use SendKeys or CDO but is there any
examples on how to do that?
thanks


Ron de Bruin

sending email using macros
 
Hi

I have CDO examples on my site
http://www.rondebruin.nl/cdo.htm

I believe the Body Outlook Express examples are also working with Notes
http://www.rondebruin.nl/mail/oebody.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl



wrote in message oups.com...
hi
How can i send email to a lotus notes server or other email servers
using excel macro by clicking a button.
I read in the newsgroups to use SendKeys or CDO but is there any
examples on how to do that?
thanks




AndyOne[_2_]

sending email using macros
 

Ron, can you help me to get started with this..?

From this part on I´m totally confused.

"Sub Message()
' This example use late binding, you don't have to set a reference
' You must be online when you run the sub
Dim iMsg As Object
Dim iConf As Object
Dim cell As Range
' Dim Flds As Variant"

Can you tell me what to press and where to insert all this stuff..??

Thanks!


--
AndyOne
------------------------------------------------------------------------
AndyOne's Profile: http://www.excelforum.com/member.php...o&userid=20217
View this thread: http://www.excelforum.com/showthread...hreadid=374879


Ron de Bruin

sending email using macros
 
Hi Andy

You must copy the macro in a module in your workbook

We use this test macro

Fill in your server in this macro in this line
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Fill in your SMTP server here"
And your e-mail address in this line
.To = "


Sub Mail_CDO()
Dim iMsg As Object
Dim iConf As Object
Dim Flds As Variant
Set iMsg = CreateObject("CDO.Message")
Set iConf = CreateObject("CDO.Configuration")
iConf.Load -1 ' CDO Source Defaults
Set Flds = iConf.Fields
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Fill in your SMTP server here"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
With iMsg
Set .Configuration = iConf
.To = "
.CC = ""
.BCC = ""
.From = """Ron"" "
.Subject = "Important message"
.TextBody = "Hi there" & vbNewLine & vbNewLine & _
"Good evening"
.Send
End With
Set iMsg = Nothing
Set iConf = Nothing
End Sub

First we open the VBA editor with Alt-F11
Then we use InsertModule
Copy/Paste the macro in this module (change the address in the macro to yours(for testing))
Now we use Alt-Q to go back to Excel


Then In Excel we use Alt-F8 to get the list with macro's
Select the macro and press Run

Post back if you need more help


--
Regards Ron de Bruin
http://www.rondebruin.nl



"AndyOne" wrote in message
...

Ron, can you help me to get started with this..?

From this part on I´m totally confused.

"Sub Message()
' This example use late binding, you don't have to set a reference
' You must be online when you run the sub
Dim iMsg As Object
Dim iConf As Object
Dim cell As Range
' Dim Flds As Variant"

Can you tell me what to press and where to insert all this stuff..??

Thanks!


--
AndyOne
------------------------------------------------------------------------
AndyOne's Profile: http://www.excelforum.com/member.php...o&userid=20217
View this thread: http://www.excelforum.com/showthread...hreadid=374879




AndyOne[_3_]

sending email using macros
 

Hey Ron;

thanks for your help.

Do I have to (and how) save the macro before going back to excel?
Because; if not, it does not appear on the list of macros.

Andy


--
AndyOne
------------------------------------------------------------------------
AndyOne's Profile: http://www.excelforum.com/member.php...o&userid=20217
View this thread: http://www.excelforum.com/showthread...hreadid=374879


Ron de Bruin

sending email using macros
 
Because; if not, it does not appear on the list of macros.

Try it again

First we open the VBA editor with Alt-F11
Then we use InsertModule
Copy/Paste the macro in this module (change the address in the macro to yours(for testing))
Now we use Alt-Q to go back to Excel

It is in the Alt-F8 list now
If you save the file you will save the macro also


--
Regards Ron de Bruin
http://www.rondebruin.nl



"AndyOne" wrote in message
...

Hey Ron;

thanks for your help.

Do I have to (and how) save the macro before going back to excel?
Because; if not, it does not appear on the list of macros.

Andy


--
AndyOne
------------------------------------------------------------------------
AndyOne's Profile: http://www.excelforum.com/member.php...o&userid=20217
View this thread: http://www.excelforum.com/showthread...hreadid=374879




AndyOne[_4_]

sending email using macros
 

Hey,

so far so good. But when running the macro an error occurs. In the code
it highlights ".Send". In one of the last lines of the code.

Do you whats wrong?

Thanks a lot so far!


--
AndyOne
------------------------------------------------------------------------
AndyOne's Profile: http://www.excelforum.com/member.php...o&userid=20217
View this thread: http://www.excelforum.com/showthread...hreadid=374879


Ron de Bruin

sending email using macros
 
Hi Andy

Are you online ?
Do you use Win 2000 or Win XP ?
Have you fill in your smtp server in the code ?



--
Regards Ron de Bruin
http://www.rondebruin.nl



"AndyOne" wrote in message
...

Hey,

so far so good. But when running the macro an error occurs. In the code
it highlights ".Send". In one of the last lines of the code.

Do you whats wrong?

Thanks a lot so far!


--
AndyOne
------------------------------------------------------------------------
AndyOne's Profile: http://www.excelforum.com/member.php...o&userid=20217
View this thread: http://www.excelforum.com/showthread...hreadid=374879




AndyOne[_5_]

sending email using macros
 

Ron;

yes, I am online and I filled in the server as you told me to.

I am using Windows XP.


--
AndyOne
------------------------------------------------------------------------
AndyOne's Profile: http://www.excelforum.com/member.php...o&userid=20217
View this thread: http://www.excelforum.com/showthread...hreadid=374879


Ron de Bruin

sending email using macros
 
Hi Andy

Maybe your IT department or firewall block it


"AndyOne" wrote in message
...

Ron;

yes, I am online and I filled in the server as you told me to.

I am using Windows XP.


--
AndyOne
------------------------------------------------------------------------
AndyOne's Profile: http://www.excelforum.com/member.php...o&userid=20217
View this thread: http://www.excelforum.com/showthread...hreadid=374879





All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com