ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Displaying mail with Excel (https://www.excelbanter.com/excel-programming/340086-displaying-mail-excel.html)

Santiago[_3_]

Displaying mail with Excel
 
I'm trying to open an email from excel with special body, subject, etc etc
and works perfectly with office 2003 (which I have). Sent it to somebdy with
office 2000 and did not work, but changed the reference to an older one, and
worked on both (off XP and off 2000) but it did not on Office XP!!! that was
weird... HELP! HELP!

Here's the code.

Dim myOlapp As New Outlook.Application
Dim myOLItem As Outlook.MailItem
Dim myVar As Integer

Set myOLItem = myOlapp.CreateItem(olMailItem)
myVar = 12

With myOLItem
.Subject = MailSubject
.To = Recipient
.Body = Mailbody
.Attachments.Add Attachment
.Display
End With


Ron de Bruin

Displaying mail with Excel
 
Hi Santiago

Use Late binding and try again

See the bottom of the page
http://www.rondebruin.nl/mail/folder2/mail1.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Santiago" wrote in message ...
I'm trying to open an email from excel with special body, subject, etc etc
and works perfectly with office 2003 (which I have). Sent it to somebdy with
office 2000 and did not work, but changed the reference to an older one, and
worked on both (off XP and off 2000) but it did not on Office XP!!! that was
weird... HELP! HELP!

Here's the code.

Dim myOlapp As New Outlook.Application
Dim myOLItem As Outlook.MailItem
Dim myVar As Integer

Set myOLItem = myOlapp.CreateItem(olMailItem)
myVar = 12

With myOLItem
.Subject = MailSubject
.To = Recipient
.Body = Mailbody
.Attachments.Add Attachment
.Display
End With




JNW

Displaying mail with Excel
 
Here is what I have for office 2000. Hope it helps

Dim OutApp As Object
Dim OutMail As Object

Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)

With OutMail
.to = ""
.CC = ""
.BCC = ""
.Subject = Subj
.Body = Subj
.Attachments.Add ActiveWorkbook.FullName
.Send 'or use .Display
End With
Set OutMail = Nothing
Set OutApp = Nothing


"Santiago" wrote:

I'm trying to open an email from excel with special body, subject, etc etc
and works perfectly with office 2003 (which I have). Sent it to somebdy with
office 2000 and did not work, but changed the reference to an older one, and
worked on both (off XP and off 2000) but it did not on Office XP!!! that was
weird... HELP! HELP!

Here's the code.

Dim myOlapp As New Outlook.Application
Dim myOLItem As Outlook.MailItem
Dim myVar As Integer

Set myOLItem = myOlapp.CreateItem(olMailItem)
myVar = 12

With myOLItem
.Subject = MailSubject
.To = Recipient
.Body = Mailbody
.Attachments.Add Attachment
.Display
End With



All times are GMT +1. The time now is 12:00 AM.

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