Printing Outlook 2003 with Word 2003 Template casuiing crash?

  • Thread starter Thread starter Kristy
  • Start date Start date
K

Kristy

Hi

I have a VB6.0 Com Addin that allows me to Print Outlook messages via
a Word Template. This causes Outlook to crash with Outlook 2003 (2000,
XP are OK) if Word isn't already open and I try to programmatically
create the object. The addin doesn't get disabled and I don't have
Nortons or any other script blockers running.

What's weird is that the crash doesn't happen until the subroutine has
finished running, after the message has printed - at that time it
kicks me out of outlook, very frustrating!

The code that is causing the crash is...

Dim objWord As Word.Application
Set objWord = GetObject(, "Word.Application")
On Error GoTo 0
If objWord Is Nothing Then
Err.Clear
Set objWord = CreateObject("Word.Application")
End If


Any ideas????

Kristy
 
I've seen some odd crashes using GetObject, but they seem more related to
the Windows version than the Outlook version. Try just using CreateObject.
 
Hi Ken

Strangely enough it is the CreateObject that causes the problem! I
use Getobject first to see if Word is already open, if 'yes' then
piggyback on that so CreateObject is never used and NO Outlook crash,
if 'no' CreateObject is called, Word is opened, message is printed,
Word is restored then Outlook crashes on exiting the print sub
routine?

I have no idea what's going on!

Thanks

Kristy
 
Weird. And you're not using any script stoppers like those from Norton or
McAfee or any personal firewalls that might block that? Can you write a
simple VBA macro that plays with CreateObject and see if that also crashes
out?
 
Back
Top