469,602 Members | 1,838 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,602 developers. It's quick & easy.

automation "Object reference not set to an instance of an object."

I'm doing a server side automation(I know it's bad but..) and its working
fine locally and when accessing it from a remote machine using web browser is
was giving me this error"Retrieving the COM class factory for component with
CLSID
{000209FF-0000-0000-C000-000000000046} failed due to the following error:
80070005". so I configured the server using dcomcnfg as described in this
link:
http://support.microsoft.com/kb/288368/
and know this error now is gone but I'm having this error:"Object reference
not set to an instance of an object." when it comes to the last line of this
code:

Word.Application wrdApp;
Word._Document wrdDoc;
wrdApp = new Word.Application();
wrdDoc = wrdApp.Documents.Add(ref oName, ref oFalse,
ref oMissing, ref oMissing);
wrdDoc.Select();
Apr 27 '07 #1
3 2766
Do you actually have a valid object? meaning is wrdApp non-null? If this is
true, the particular property or method may not exist on the object.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Badis" <Ba***@discussions.microsoft.comwrote in message
news:8D**********************************@microsof t.com...
I'm doing a server side automation(I know it's bad but..) and its working
fine locally and when accessing it from a remote machine using web browser
is
was giving me this error"Retrieving the COM class factory for component
with
CLSID
{000209FF-0000-0000-C000-000000000046} failed due to the following error:
80070005". so I configured the server using dcomcnfg as described in this
link:
http://support.microsoft.com/kb/288368/
and know this error now is gone but I'm having this error:"Object
reference
not set to an instance of an object." when it comes to the last line of
this
code:

Word.Application wrdApp;
Word._Document wrdDoc;
wrdApp = new Word.Application();
wrdDoc = wrdApp.Documents.Add(ref oName, ref oFalse,
ref oMissing, ref oMissing);
wrdDoc.Select();

Apr 27 '07 #2
But, why it runs OK when I run it in local machine in the debug mode!?

"Alvin Bruney [MVP]" wrote:
Do you actually have a valid object? meaning is wrdApp non-null? If this is
true, the particular property or method may not exist on the object.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Badis" <Ba***@discussions.microsoft.comwrote in message
news:8D**********************************@microsof t.com...
I'm doing a server side automation(I know it's bad but..) and its working
fine locally and when accessing it from a remote machine using web browser
is
was giving me this error"Retrieving the COM class factory for component
with
CLSID
{000209FF-0000-0000-C000-000000000046} failed due to the following error:
80070005". so I configured the server using dcomcnfg as described in this
link:
http://support.microsoft.com/kb/288368/
and know this error now is gone but I'm having this error:"Object
reference
not set to an instance of an object." when it comes to the last line of
this
code:

Word.Application wrdApp;
Word._Document wrdDoc;
wrdApp = new Word.Application();
wrdDoc = wrdApp.Documents.Add(ref oName, ref oFalse,
ref oMissing, ref oMissing);
wrdDoc.Select();


Apr 30 '07 #3
The probable explanation for this is that you have two different word
objects installed on these different machines. You can go trouble-shooting
to find out, but it's really an exercise in futility. Just make sure that
the app that is failing contains the appropriate word version registered.
That may clear it up.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Badis" <Ba***@discussions.microsoft.comwrote in message
news:FA**********************************@microsof t.com...
But, why it runs OK when I run it in local machine in the debug mode!?

"Alvin Bruney [MVP]" wrote:
>Do you actually have a valid object? meaning is wrdApp non-null? If this
is
true, the particular property or method may not exist on the object.

--
Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
OWC Black book on Amazon and
www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley
"Badis" <Ba***@discussions.microsoft.comwrote in message
news:8D**********************************@microso ft.com...
I'm doing a server side automation(I know it's bad but..) and its
working
fine locally and when accessing it from a remote machine using web
browser
is
was giving me this error"Retrieving the COM class factory for component
with
CLSID
{000209FF-0000-0000-C000-000000000046} failed due to the following
error:
80070005". so I configured the server using dcomcnfg as described in
this
link:
http://support.microsoft.com/kb/288368/
and know this error now is gone but I'm having this error:"Object
reference
not set to an instance of an object." when it comes to the last line of
this
code:

Word.Application wrdApp;
Word._Document wrdDoc;
wrdApp = new Word.Application();
wrdDoc = wrdApp.Documents.Add(ref oName, ref oFalse,
ref oMissing, ref oMissing);
wrdDoc.Select();



May 1 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by James Carroll | last post: by
reply views Thread by J Williams | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.