Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro for e-mailing excel file using outlook
I have created a macro to produce a report and I would
like to finish the macro off by getting it to e-mail the report to the recipients. I have tried the macro below and although it works and sends the file it doesn't enable me to include a message in the body of the e-mail. ActiveWorkbook.SendMail Recipients:=Range("c4"), subject:=Range("c2") I have tried one or two bits of code that I have found on internet sites but they never seem to work properly. The report will be saved before the e-mail bit of the macro is run and I am using excel 2000 and outlook 98....can anyone help? Cheers Miserable Matt |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro for e-mailing excel file using outlook
http://www.rondebruin.nl/sendmail.htm
www.dicks-clicks.com Have sample code for several situations. Regards, Tom Ogilvy "matt" wrote in message ... I have created a macro to produce a report and I would like to finish the macro off by getting it to e-mail the report to the recipients. I have tried the macro below and although it works and sends the file it doesn't enable me to include a message in the body of the e-mail. ActiveWorkbook.SendMail Recipients:=Range("c4"), subject:=Range("c2") I have tried one or two bits of code that I have found on internet sites but they never seem to work properly. The report will be saved before the e-mail bit of the macro is run and I am using excel 2000 and outlook 98....can anyone help? Cheers Miserable Matt |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro for e-mailing excel file using outlook
In addition, there is some code for sending email using Outlook at:
www.rubbershoe.com/olmail.htm "matt" wrote in message ... I have created a macro to produce a report and I would like to finish the macro off by getting it to e-mail the report to the recipients. I have tried the macro below and although it works and sends the file it doesn't enable me to include a message in the body of the e-mail. ActiveWorkbook.SendMail Recipients:=Range("c4"), subject:=Range("c2") I have tried one or two bits of code that I have found on internet sites but they never seem to work properly. The report will be saved before the e-mail bit of the macro is run and I am using excel 2000 and outlook 98....can anyone help? Cheers Miserable Matt |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
macro for e-mailing excel file using outlook
I have used this and it works great just do not upgrade
to outlook XP or the outlook object model guard security patch or you will get a pop up every time 'E-mail out using outlook not used at this time due to out object model guard ' be sure to reference microsft outlook ' Dim objotech As Outlook.Application ' Dim objmailitemtech As Outlook.MailItem ' Set objotech = New Outlook.Application ' Set objmailitemtech = objotech.CreateItem(olMailtItem) ' With objmailitemtech ' .To = acontactlistinoutlook ' .CC = sameasabove ' .Body = txtMessage ' .SentOnBehalfOfName = yourname ' .send ' End With ' Set objmailitemtech = Nothing ' Set objotech = Nothing Or if you have a smtp server you can use this code Set iConf = CreateObject("CDO.Configuration") Set Flds = iConf.Fields ' Set the CDOSYS configuration fields to use port 25 on the SMTP server. With Flds .Item ("http://schemas.microsoft.com/cdo/configuration/sendusing ") = cdoSendUsingPort 'ToDo: Enter name or IP address of remote SMTP server. .Item ("http://schemas.microsoft.com/cdo/configuration/smtpserve r") = "smtp.yourserver.com" .Item ("http://schemas.microsoft.com/cdo/configuration/smtpconne ctiontimeout") = 10 .Update End With ' Build HTML for message body. ' Apply the settings to the message. With imsg Set .Configuration = iConf .To = addressto 'Enter a valid email address." .From = addressfrom 'ToDo: Enter a valid email address. .Subject = " " .HTMLBody = txtMessage .send End With End Sub -----Original Message----- I have created a macro to produce a report and I would like to finish the macro off by getting it to e-mail the report to the recipients. I have tried the macro below and although it works and sends the file it doesn't enable me to include a message in the body of the e-mail. ActiveWorkbook.SendMail Recipients:=Range("c4"), subject:=Range("c2") I have tried one or two bits of code that I have found on internet sites but they never seem to work properly. The report will be saved before the e-mail bit of the macro is run and I am using excel 2000 and outlook 98....can anyone help? Cheers Miserable Matt . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Creating mailing lists in outlook web access | Excel Discussion (Misc queries) | |||
Is excel mailing list exportable to Outlook Contacts? | Excel Discussion (Misc queries) | |||
how do i convert a mailing list in excel to outlook | Excel Discussion (Misc queries) | |||
which is best for mailing list management, Outlook or Excel? | New Users to Excel | |||
I want to do mass mailing in outlook, from an excel file that has. | Excel Discussion (Misc queries) |