|
-
help sending rtf, doc, text as body in outlook
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
Similar Threads
-
Replies: 3
Last Post: 02-22-2006, 03:51 AM
-
By The Merg in forum VB Classic
Replies: 6
Last Post: 02-07-2006, 11:30 AM
-
By Kevin in forum VB Classic
Replies: 3
Last Post: 12-05-2005, 06:25 PM
-
Replies: 3
Last Post: 08-30-2001, 11:45 AM
-
By George Gilbert in forum vb.announcements
Replies: 0
Last Post: 08-19-2001, 11:34 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks