Catastrophic Failure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Office 2000 Outlook add-in that when using Word as the email
editor, reads the document and inserts text into the word document. When I
try to set the modified text to the email body:

objMailItem.HTMLBody = pubDocCurrent.HTMLProject.HTMLProjectItems.Item(1).Text

I get a MsgBox on the email stating: "Catastrophic Failure".

Is there a way to put a modified Word-HTML back into the email body.
 
What's causing the failure? Try getting that text as a string value and
putting that into HTMLBody and see if you get the failure before the setting
of the text. That set of dot operators makes it impossible to know where the
failure occurs.
 
I did try the following:
Dim strX as String
strX = pubDocCurrent.HTMLProject.HTMLProjectItems.Item(1).Text

As I step through (F8) the project, the error happens when I step into the
above statement. The msgbox on the email has a caption of Microsoft Word.
There are no discernible errors from within Visual Studio. In fact, if I "ok"
the msgbox and return to Visual Studio, I can proceed. The word-html is now
assigned to objMailItem.HTMLBody as I wished.

Immediately after this call, the email is sent. Looking at the Sent Items
folder, the email is correct. Naturally, this msgbox is unacceptable.
 
Break it down further. Using lots of dot operators makes it impossible to
see where an error occurs. Set a document object to pubDocCurrent and so on
for each dot operator you have. I have no idea what they are so I can't
advise you on them.
 
ok.

Set ml0 = evnWordApp.ActiveDocument
Set ml1 = evnWordApp.ActiveDocument.HTMLProject
Set ml2 = evnWordApp.ActiveDocument.HTMLProject.HTMLProjectItems
Above...no error
Below..'Can't compile'
'Set ml3 = evnWordApp.ActiveDocument.HTMLProject.HTMLProjectItems.Items(1)
'Set ml4 =
evnWordApp.ActiveDocument.HTMLProject.HTMLProjectItems.Items(1).Text

So it breaks on:
Set ml3 = evnWordApp.ActiveDocument.HTMLProject.HTMLProjectItems.Items(1)
 
Well, since I have no idea what HTMLProject or HTMLProject.HTMLProjectItems
are I can't comment on that. Look in the Object Browser for whatever objects
you're using to see what properties are available.

Normally I'd use Document.Range.Text, but I don't know what you're doing.
 
I need the microsoft generated html.

Incidently, I tried this with Office 2003 on WinXP and it worked just fine....
 
Well again I still don't know exactly what you're doing so I can't comment.
Some things that are available in WordMail in earlier versions of Outlook
aren't available with WordMail in Outlook 2007. Whatever it is you're trying
to do may fit into that category. If so you have to find a different way to
do what you want.
 
Back
Top