View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Marchand Marchand is offline
external usenet poster
 
Posts: 5
Default CreateObject("Word.Application") fails though Word session starts

Thanks for your respones, and your questions.
- I absolutely agree that 1004 isn't a useful error code -- but it's
the only one Excel's providing.
- The 'objWordApp' object is declared with a "Public Const gobjWordApp
as Object" in a separate modeul in the application. Thus it does use
late binding.
- The idea of a missing reference is interesting. The "Tools /
References" within VBE look normal. And I can easily create the Word
session, just not (always) get it assigned to an Excel variable. Is
there something I'm missing here, that I'm not checking but should?

/ T /

On Apr 2, 5:01 pm, Dave Peterson wrote:
I don't know. But maybe a few more questions/answers will help someone else
come up with an idea.

How did you declare gobjWordApp?

Did you declare it as an object (using late binding) or did you add a reference
to that workbook's project--and maybe the reference is missing???

What is the error description? 1004 isn't really too helpful.



wrote:

We have an Excel application which fails for some users, sometimes,
with a 1004 at the line:
Set gobjWordApp = CreateObject("Word.Application")
where gobjWordApp has been defined as an Object.
What's interesting is that the Word session has been started, as per
Task Manager. It isn't visible to the user at that point (as expected)
and the gobjWordApp object is undefined.. So while Word is there, it
looks like the reference/pointer back to VBA simply doesn't occur.
Additional hints: Changing the line to a simple
"CreateObject("Word.Application") works fine -- although it's pretty
useless for the application since there's no addressable object for
VBA to interact with.
Re-installing Office doesn't change anything.
The typical environment is Windows XP/SP2 and Office 2003/SP2 or
SP3.
There doesn't seem to be a particular pattern in terms of who this
works for and who it fails for, although we're getting suspicious of
the new Vista-compatible versions of HP printer drivers.
Has anyone had experience with this kind of problem or, even
better, know of a fix?


/ Tyla /


--

Dave Peterson