Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual 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 ASP Free Forums Sponsor:
  #1  
Old March 26th, 2006, 07:18 PM
lew26 lew26 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Location: St. Petersburg
Posts: 6 lew26 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 8 sec
Reputation Power: 0
Send a message via MSN to lew26
Sending rtf, doc, text as message body in outlook 2003 in vb.net

Hi,

I am trying to send a document using vb.net and outlook and words, The type of file i would like to send are (rtf, doc, txt) as the message body in the outlook message. Any one with experince in this area the help will be surely appreciated.

I have added the code below i get some type of hresult type error when i run this.





Public Sub SendDocMsg(ByVal subjectp As String, ByVal pEmail As String, _
ByVal fileDirLocation As String)

recipient = pEmail
subject = subjectp

Dim oLApp As Object
Dim oItem As Object
Dim oDoc As Object


On Error GoTo errorHandler


'Create a new mailitem
' oOutlook = New Outlook.Application
oLApp = CreateObject("Outlook.Application")
oItem = oLApp.CreateItem(0)
oDoc = CreateObject("Word.Application")
oDoc.Visible = True
oDoc.Documents.Open(fileDirLocation)


With oItem

'Set the recipient for the new email
.To = mRecipient

'Set the recipient for a copy
'.CC = "recipient2@mail.com"

'Set the subject
.Subject = mSubject

'The content of the document is used as the body for the email
.Body = oDoc.ActiveDocument.Content

.Send()
End With


errorHandler:
MsgBox(Err.Number & " " & Err.Description)
'Clean up
oItem = Nothing
oLApp = Nothing
oDoc = Nothing

End Sub ' SendMsg

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Sending rtf, doc, text as message body in outlook 2003 in vb.net


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 6 hosted by Hostway
Stay green...Green IT