Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating mailing lists in outlook web access Greener2224 Excel Discussion (Misc queries) 1 November 7th 08 03:05 PM
Is excel mailing list exportable to Outlook Contacts? Leanne Excel Discussion (Misc queries) 12 March 9th 08 08:21 PM
how do i convert a mailing list in excel to outlook chvbob Excel Discussion (Misc queries) 4 October 14th 05 05:43 PM
which is best for mailing list management, Outlook or Excel? Thrival New Users to Excel 1 March 4th 05 07:55 PM
I want to do mass mailing in outlook, from an excel file that has. Franco Excel Discussion (Misc queries) 2 January 25th 05 07:49 AM


All times are GMT +1. The time now is 12:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"