Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Other Office > Visual Studio Tools for Office
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Studio Tools for Office Be sure to specify which version you are working with.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio Tools for Office section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old March 26th, 2006, 07:24 PM
Registered User
 
Join Date: Mar 2006
Location: Melrose, Minnesota
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Willie Johnson Jr
Default 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


Digit Solver
Reply With Quote
Reply


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
reading a html doc into outlook body message matpen Word VBA 5 June 21st, 2009 10:19 PM
open text and add to outlook body mlov83 BOOK: Professional Outlook 2007 Programming ISBN: 978-0-470-04994-5 0 February 16th, 2008 07:48 AM
Copy text from 1 doc to other doc thru vba in word itchock Word VBA 2 December 29th, 2006 01:47 AM
Report vs. RTF Text Cut-Off SerranoG Access 1 July 18th, 2005 03:14 PM
Convert RTF Text to ASCII Text LouSchweichler Access 2 December 3rd, 2003 02:50 PM



All times are GMT -4. The time now is 07:52 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.