PC Review


Reply
Thread Tools Rate Thread

CreateObject("Word.Application") fails though Word session starts

 
 
tyla@udapps.com
Guest
Posts: n/a
 
      3rd Apr 2008
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 /


 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      3rd Apr 2008
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.

(E-Mail Removed) 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
 
Reply With Quote
 
Marchand
Guest
Posts: n/a
 
      3rd Apr 2008
Dave,



On Apr 2, 5:01 pm, Dave Peterson <peter...@verizonXSPAM.net> 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.
>
>
>
> t...@udapps.com 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


 
Reply With Quote
 
Marchand
Guest
Posts: n/a
 
      3rd Apr 2008
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 <peter...@verizonXSPAM.net> 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.
>
>
>
> t...@udapps.com 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


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      3rd Apr 2008
I still don't have a guess.

But when you see that 1004 error, what's the error description that you see?



Marchand wrote:
>
> 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 <peter...@verizonXSPAM.net> 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.
> >
> >
> >
> > t...@udapps.com 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


--

Dave Peterson
 
Reply With Quote
 
Marchand
Guest
Posts: n/a
 
      3rd Apr 2008
Dave,



On Apr 2, 5:58 pm, Dave Peterson <peter...@verizonXSPAM.net> wrote:
> I still don't have a guess.
>
> But when you see that 1004 error, what's the error description that you see?
>
>
>
> Marchand wrote:
>
> > 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 <peter...@verizonXSPAM.net> 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.

>
> > > t...@udapps.com 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

>
> --
>
> Dave Peterson


 
Reply With Quote
 
JP
Guest
Posts: n/a
 
      3rd Apr 2008
See http://tinyurl.com/yp95cb


HTH,
JP


On Apr 2, 7:17*pm, t...@udapps.com 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 /


 
Reply With Quote
 
papou
Guest
Posts: n/a
 
      3rd Apr 2008
Hi
Why do you declare your Word Object as a constant?
I do not see any reason so far with the info you provided.
In addition there is obviously a mistake in this line:
Public Const gobjWordApp as Object

Can you just try and change to:
Public objWordApp As Object

And see if it works?

HTH
Cordially
Pascal

"Marchand" <(E-Mail Removed)> a écrit dans le message de news:
d644ed27-2b60-4db7-afb8-99822ee1c740...oglegroups.com...
> 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 <peter...@verizonXSPAM.net> 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.
>>
>>
>>
>> t...@udapps.com 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

>



 
Reply With Quote
 
tyla@udapps.com
Guest
Posts: n/a
 
      3rd Apr 2008

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, t...@udapps.com 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 /


 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      3rd Apr 2008
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.

(E-Mail Removed) 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, t...@udapps.com 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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OLK2007 : The Oper Failed : Application.CreateObject("MAPI.Session =?Utf-8?B?QmlsbCBCaWxsbWlyZQ==?= Microsoft Outlook Form Programming 3 7th Jan 2007 01:02 AM
Bug in Access 2003 ? Error after 380 CreateObject("MAPI.Session") Ottar Microsoft Access 7 22nd Jun 2004 06:58 PM
Bug in Access 2003 ? Error after 380 CreateObject("MAPI.Session") Ottar Microsoft Access VBA Modules 7 22nd Jun 2004 06:58 PM
Error after 380 CreateObject("MAPI.Session") Ottar Microsoft Access 3 20th Jun 2004 06:52 PM
if in asp is CreateObject("Microsoft.XMLHTTP"). Is in asp.net this Server.CreateObject("MSXML2.ServerXMLHTTP") ? Raúl Martín Microsoft ASP .NET 1 13th May 2004 04:47 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:45 AM.