PLEASE HELP: Email Excel worksheet in body, not as an attachment
Hi,
I know how to send an Excel worksheet as an attachment, but does anyone know how to send the worksheet in the body of the email? If you do File -> Send To -> Mail Recipient, you'll be able to send the worksheet in the message body, but I couldn't seem to find a way to do this in VB. Any help would be greatly appreciated. Thank you.
16-06-2003 at 09:11 PM
|
~Bean~ Level: VB Guru Registered: 07-04-2003 Posts: 488
Re: PLEASE HELP: Email Excel worksheet in body, not as an attachment
I cannot duplicate such a mail, but if you'd like to e-mail me an example I would be happy to take a look at it...
____________________________
Eggheads unite! You have nothing to lose but your yolks.
17-06-2003 at 05:26 PM
|
steve_w Level: Moderator Registered: 18-04-2003 Posts: 1156
Re: PLEASE HELP: Email Excel worksheet in body, not as an attachment
Hi Karsch
I have done it.
Private Sub Command1_Click()
Dim olapp As Outlook.Application
Dim olmsg As Outlook.MailItem
Dim xlapp As Excel.Application
Dim html As String
Dim singlechar As String
Dim ff As Integer
ff = FreeFile
Set xlapp = New Excel.Application
xlapp.Workbooks.Open "c:book1.xls"
xlapp.ActiveWorkbook.SaveAs "c:book1.htm", XlFileFormat.xlHtml
xlapp.Quit
Set xlapp = Nothing
Open "c:book1.htm" For Binary As #ff
Do While Not EOF(ff)
singlechar = Input(1, #1)
html = html & singlechar
Loop
Close #ff
Set olapp = New Outlook.Application
Set olmsg = olapp.CreateItem(olMailItem)