View Single Post
  #11   Report Post  
Posted to microsoft.public.excel.programming
[email protected] tyla@udapps.com is offline
external usenet poster
 
Posts: 5
Default CreateObject("Word.Application") fails though Word session starts

Yup -- Word definitely starts. There's WINWORD.exe process showing as
running in Task Manager after CreateObject() executes.
I'll play with the 'on error' code see if I can tease out any more
details.

On Apr 3, 10:32 am, Dave Peterson wrote:
But you're positive that MSWord is started???

I'd use:

on error resume next
set gobjWordAPp = CreateObject("Word.Application")
if err.number < 0 then
msgbox "something bad happened"
err.clear
exit sub '????
end if
on error goto 0

But that just masks the error--it doesn't explain why MSWord is really started.
I still don't have a guess for that.



wrote:

My apoligies for some of the misingofmation in this thread from a well-
meaning colleague.
The relevant code surrounding the problem is
Dim gobjWordAPp as Object
'...
set gobjWordAPp = CreateObject("Word.Application")


THe 1004 error message is the very generic
"Run time error 1004" with no further details


JP, thanks for the link. I've never used the second parameter of
CreateObject() but will try it and see, and get back to this thread
with the results.


/ Tyla /


On Apr 2, 4:17 pm, 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