Results 1 to 2 of 2
  1. #1
    cutterbl
    Guest

    HTML Editor (Outlook 2000)

    I would use Exchange for this, but my client won't buy it...

    So, MSKB article Q183209 states:
    "If you are using an HTML Mail message, you can use the Outlook object model to access the HTML Document Object Model and use that object model to manipulate the embedded HTML."
    Sounds great. Well...first thing I found I had to do was create an object reference (they left that little tidbit out), but now I still haven't figured out the how. All I want to do is set the value of a variable using the contents of a div tag of an incoming mail message with a specific Subject. Nada...I've tried 27 different permutations to try and figure this out. Oh yeah, by the way, I tried the example code attached to the HTMLEditor help and, you guessed it, NADA. I'm going crazy. Here's my latest (of many) effort...

    Dim sSubject As String
    Dim sBody As String

    Set myInspector = Item.GetInspector
    Set myIExplorer = myInspector.HTMLEditor
    Set myContent = myIExplorer.All.Item
    sSubject = myContent.HTMLDivElement.ID("Subject").outerHTML
    sBody = myContent.HTMLDivElement.ID("body").outerHTML

    Set oldItem = Item
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myOlTaskFolder = myNameSpace.GetDefaultFolder(olFolderTasks)
    Set myItems = myOlTaskFolder.Items
    Set newDMVTaskItem = myItems.Add

    newDMVTaskItem.Subject = sSubject
    newDMVTaskItem.Body = sBody

    newDMVTaskItem.Save
    newDMVTaskItem.UnRead = True
    oldItem.UnRead = False
    oldItem.Delete

    Any help is greatly appreciated.

    Cutter

  2. #2
    cutterbl
    Guest

    Re: HTML Editor (Outlook 2000)

    After much experimenting I've come to this. Initially it will give me an error, which I choose to "Debug". I then "Continue" and it creates my new task, with the subject set to the contents of the div "bodyone" from the original MailItem.HTMLBody. Does Anyone know why I might receive the error (when it does work) and how I could maybe bypass it?

    If Item.Subject = "X TASK" Then
    Dim sSubject As String
    Dim sBody As String

    Set myInspector = Item.GetInspector
    Set myIExplorer = myInspector.HTMLEditor
    sSubject = myIExplorer.all("bodyone").innerText

    Set oldItem = Item
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNameSpace = myOlApp.GetNamespace("MAPI")
    Set myOlTaskFolder = myNameSpace.GetDefaultFolder(olFolderTasks)
    Set myItems = myOlTaskFolder.Items
    Set newDMVTaskItem = myItems.Add

    sBody = oldItem.Body

    newXTaskItem.Subject = sSubject
    newXTaskItem.Body = sBody

    newXTaskItem.Save
    newXTaskItem.UnRead = True
    oldItem.UnRead = False
    oldItem.Delete
    End If

    P.S. TypeName(myIExplorer.all("bodyone")) = HTMLDivElement, I had to add a reference to the Microsoft HTML Object Library in order to see it all, though you won't find any help topics you can at least see it in the object browser.

    Cutter

Posting Permissions

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