Macro - SendThisSheet

  • Thread starter Thread starter carl
  • Start date Start date
C

carl

I tried to record a macro that would use the Excel
feature - "email". It did not work.

Is there some code that can automatically send a worksheet
via the excel email feature ?

Thank you for your help and guidance.
 
Yes. But don't reinvent the wheel. Ron de Bruin has the Rolls Royce of addins
when it comes toi doing this in the form of 'Sendmail' available from the
following link:-

http://www.rondebruin.nl/

He also has all the code behind it freely available so you can study it if you
want to.
 
the website is awesome but I could not figure out how to
run the code from within excel. I would like to execute
the macro from excel. Do you have any suggestions on how
to modify the code to do so ?

Thanks Again.
 
A macro you must place in a normal module in Excel

Alt-F11
Insert module from the menubar in the VBA editor
Paste the macro you want to try in there
Alt-Q to go back to Excel

In Excel press Alt-F8 to get a macro list
Select it and press Run
 
I tried to run this macro from excel. And it resulted in a
compiler error. I am running Excel2002 and Outlook2002. It
seemed to get hung up on the first line ??

Sub Mail_ActiveSheet_Body()
Dim OutApp As Outlook.Application
Dim OutMail As Outlook.MailItem
Application.ScreenUpdating = False
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(olMailItem)
With OutMail
.To = "(e-mail address removed)"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = SheetToHTML(ActiveSheet)
.Send 'or use .Display
End With
Application.ScreenUpdating = True
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
 
Back
Top