ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sneding email thru VBA (using Exchange) (https://www.excelbanter.com/excel-programming/421871-sneding-email-thru-vba-using-exchange.html)

Bigfoot17

Sneding email thru VBA (using Exchange)
 
I have seen references to using VBA in Excel to send sheets/books to
recipients. Usually questions are directed to Ron deBruin's site
(http://www.rondebruin.nl/cdo.htm). However I have two issues.

[1] I am sending using an exchange server and the references are for using
SMTP. How is using an Exchange Server different?

[2] I'd like to send the file as an attachment but could not find info on
how to accomplish this. Should I need go to the Outlook forum? (I want to
send the files from within my Excel VBA programming).

Ron de Bruin

Sneding email thru VBA (using Exchange)
 
Hi Bigfoot17

1: ask your IT department for the server name

2: On the CDO page there is a download with examples


--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm


"Bigfoot17" wrote in message ...
I have seen references to using VBA in Excel to send sheets/books to
recipients. Usually questions are directed to Ron deBruin's site
(http://www.rondebruin.nl/cdo.htm). However I have two issues.

[1] I am sending using an exchange server and the references are for using
SMTP. How is using an Exchange Server different?

[2] I'd like to send the file as an attachment but could not find info on
how to accomplish this. Should I need go to the Outlook forum? (I want to
send the files from within my Excel VBA programming).


codex

Sneding email thru VBA (using Exchange)
 
..

codex

Sneding email thru VBA (using Exchange)
 

Hi,
add references : microsoft outlook xxxx object library

if you want to send your shet mail body use this code :

Sub mailsend()
' Requires reference to Microsoft Outlook
Dim ws As Worksheet, env As MsoEnvelope, mi As MailItem
' Get the active worksheet.
Set ws = ActiveSheet
' Save the workbook before mailing as attachment.
ws.Parent.Save
' Show email header.
ws.Parent.EnvelopeVisible = True
' Get the MsoEnvelope object
Set env = ws.MailEnvelope
' Set the email header fields.
' env.Introduction = "Please revew attached file."
' Get the MailItem object.
Set mi = env.Item
' Clear the MailItem properties.
ClearMessage mi
' Set MailItem properties.
mi.Importance = olImportanceHigh
' Set MailItem properties ImportanceHigh.
mi.SentOnBehalfOfName = "
' Set MailItem sender if use different sender.
mi.To = "
mi.CC = "
mi.Subject = "Subject text in here"
' Attach this workbook.
mi.Attachments.Add "d:\sample.pdf" ''ThisWorkbook.FullName
' Uncomment this to send automatically.
mi.Send
End Sub

and if you want to send your any document, use :

mi.Attachments.Add


All times are GMT +1. The time now is 09:15 AM.

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