Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old July 25th, 2003, 07:30 AM
mxtaza mxtaza is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Karachi, Pakistan
Posts: 2 mxtaza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
save email in Outlook Automation

I m working on MS Outlook automation...

my problem is.... when i tried to save my email using "myMail.saveAs" property then it does not save the body of email... i printed the email body just befor sending it using debug.print myMail.HTMLBody.. and it displays it but does not show me neither in sent folder nor in saved email but the recieved email shows the body correctly

i m using Outlook 2002 with VB 6

plz help me out ... many thanx in advance
Murtaza

code is written below:
------------------------------------------------------------

Dim myMail As MailItem
Dim myRecipient As Recipient
Dim myAttachments As Attachments

Set myMail = outApp.CreateItem(olMailItem)

Set myAttachments = myMail.Attachments
myAttachments.Add "C:\MyWord.doc"

Set myRecipient = myMail.Recipients.Add("mxtaza@test.com")

myMail.SentOnBehalfOfName = "test@test.com"

myMail.Subject = param_subject
myMail.HTMLBody = param_body

Debug.Print myMail.HTMLBody

myMail.SaveAs App.Path & "\SentEmail.msg"
myMail.Send

Set myAttachments = Nothing
Set myRecipient = Nothing
Set myMail = Nothing

Reply With Quote
  #2  
Old July 25th, 2003, 08:59 AM
mxtaza mxtaza is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Karachi, Pakistan
Posts: 2 mxtaza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
solution to save email in Outlook Automation

hey man i ve got my answer...
just use this line before sending the email
myMail.BodyFormat = olFormatRichText

and the rest is working fine ... many many thanx for all of those who have helped me in this regard.
Murtaza

code is written below:
------------------------------------------------------------

Dim myMail As MailItem
Dim myRecipient As Recipient
Dim myAttachments As Attachments

Set myMail = outApp.CreateItem(olMailItem)

Set myAttachments = myMail.Attachments
myAttachments.Add "C:\MyWord.doc"

Set myRecipient = myMail.Recipients.Add("mxtaza@test.com")

myMail.SentOnBehalfOfName = "test@test.com"
myMail.BodyFormat = olFormatRichText
myMail.Subject = param_subject
myMail.HTMLBody = param_body

myMail.SaveAs App.Path & "\SentEmail.msg"
myMail.Send

Set myAttachments = Nothing
Set myRecipient = Nothing
Set myMail = Nothing

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > save email in Outlook Automation


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway