Consulting

Results 1 to 2 of 2

Thread: Email body to html file.

  1. #1
    VBAX Mentor
    Joined
    Nov 2008
    Posts
    305
    Location

    Email body to html file.

    Here's the situation:

    The user sends an email with an "idea" in the body.
    The email is sorted (using a message rule) into a folder.

    I then need some code that will automatically extract the body (minus any signature) and place the extracted text into an html file, or other program such as word or excel (but not override any existing text), that can then "show" the result on a webpage (so it needs to be converted to HTML in the end).

    Thanks for your help.

  2. #2
    VBAX Contributor
    Joined
    Feb 2009
    Posts
    103
    Location
    hi ukdane, this might give you an idea to accomplish your task.. it will save the whole e-mail to HTML..but doesn't extract..

    [vba]
    Sub SaveAsHMTL()
    Dim myItem As Outlook.Inspector
    Dim objItem As Object
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.ActiveInspector
    If Not TypeName(myItem) = "Nothing" Then
    Set objItem = myItem.CurrentItem
    strname = objItem.Subject
    'Prompt the user for confirmation
    Dim strPrompt As String
    strPrompt = "Are you sure you want to save the item? If a file with the same name already exists, it will be overwritten with this copy of the file."
    If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbYes Then
    objItem.SaveAs "C:\" & strname & ".html", olHTML
    End If
    Else
    MsgBox "There is no current active inspector."
    End If
    End Sub [/vba]

Posting Permissions

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