CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: office automation VBA (Outlook)

  1. #1
    Join Date
    Aug 2001

    office automation VBA (Outlook)

    I am able to automate a mailing to a list, but I cannot get the message to copy properly from the sample I set up. The text itself comes through OK but the inlline image gets lost and the text font gets lost (reverts to my default standard of Arial instead of using the font in the sample email). I have a single email (my sample) in the "sample" folder of the inbox, and this code picks up the text of that message as the content of the new message, but as I said, the inline image gets thrown out and the font is not what is used in the sample.

    Dim oApp As Outlook.Application
    Dim oNameSpace As NameSpace
    Dim oFolder As MAPIFolder
    Dim oMailItem As MailItem, oMailitem2 As MailItem

    Set oApp = New Outlook.Application
    Set oNameSpace = oApp.GetNamespace("MAPI")
    Set oFolder = oNameSpace.GetDefaultFolder(olFolderInbox)
    Set oFolder = oFolder.Folders("sample")
    Set oMailItem = oFolder.Items.GetFirst

    Set oMailitem2 = oApp.CreateItem(olMailItem)
    oMailitem2.To = "phinds@phinds.com"
    oMailitem2.BodyFormat = olFormatHTML
    oMailitem2.Body = oMailItem.Body
    oMailitem2.Subject = "sample email item 5"

    Set oMailItem = Nothing
    Set oFolder = Nothing
    Set oNameSpace = Nothing

    any ideas ???


    Paul Hinds
    vs2008, 3.5SP1 Version 9.0.21022.8 RTM

  2. #2
    Join Date
    Aug 2001

    Re: office automation VBA (Outlook)

    Solved it myself by using the object copy method to just make a copy of the sample email and then stick in the desired BCC and TO addresses
    vs2008, 3.5SP1 Version 9.0.21022.8 RTM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)