Object variable not set

K

Karen

I hope someone can help. I am using the following code from Access to open Word. I am using late binding because potential clients have Word 2000, Word 2002 and Word 2003.


dim objWord as Object

On Error Resume Next

Set objWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
Set objWord = CreateObject("Word.Application")
End If

On Error GoTo Err_cmdPhoto

The application is an Access 2003 .mde.

I have a client who has Word 2002 on his system. When he chooses the button in the Access application to open Word he gets the 'Object variable not set' message if he does not have Word open already. If he opens Word and then minimizes it he does not get the error message.

I have tested extensively on my system and a testing partner's system. Any ideas?
 
H

Helmut Obertanner

What happens when you didn't get a word process and Err <> 429 ?
Object is Nothing
Maybe test Err <> 0
or better avoid Error and test with wmi if there is a word process running.
Just an Idea.
--
regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


.... and IT works!

I hope someone can help. I am using the following code from Access to open Word. I am using late binding because potential clients have Word 2000, Word 2002 and Word 2003.


dim objWord as Object

On Error Resume Next

Set objWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
Set objWord = CreateObject("Word.Application")
End If

On Error GoTo Err_cmdPhoto

The application is an Access 2003 .mde.

I have a client who has Word 2002 on his system. When he chooses the button in the Access application to open Word he gets the 'Object variable not set' message if he does not have Word open already. If he opens Word and then minimizes it he does not get the error message.

I have tested extensively on my system and a testing partner's system. Any ideas?
 
H

Helmut Obertanner

May the function could look like this:

On Error Resume Next

Set objWord = GetObject(, "Word.Application")
If objWord is Nothing then
Set objWord = CreateObject("Word.Application")
End If

--
regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


.... and IT works!

I hope someone can help. I am using the following code from Access to open Word. I am using late binding because potential clients have Word 2000, Word 2002 and Word 2003.


dim objWord as Object

On Error Resume Next

Set objWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
Set objWord = CreateObject("Word.Application")
End If

On Error GoTo Err_cmdPhoto

The application is an Access 2003 .mde.

I have a client who has Word 2002 on his system. When he chooses the button in the Access application to open Word he gets the 'Object variable not set' message if he does not have Word open already. If he opens Word and then minimizes it he does not get the error message.

I have tested extensively on my system and a testing partner's system. Any ideas?
 
K

Karen

Thanks Helmut for responding. It didn't change the sympton. I used your
suggestion and also Err.Number <> 0. They both work on my system and my
tester's system but not on the clients.

--
Karen
May the function could look like this:

On Error Resume Next

Set objWord = GetObject(, "Word.Application")
If objWord is Nothing then
Set objWord = CreateObject("Word.Application")
End If

--
regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


.... and IT works!

I hope someone can help. I am using the following code from Access to open
Word. I am using late binding because potential clients have Word 2000,
Word 2002 and Word 2003.


dim objWord as Object

On Error Resume Next

Set objWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
Set objWord = CreateObject("Word.Application")
End If

On Error GoTo Err_cmdPhoto

The application is an Access 2003 .mde.

I have a client who has Word 2002 on his system. When he chooses the button
in the Access application to open Word he gets the 'Object variable not set'
message if he does not have Word open already. If he opens Word and then
minimizes it he does not get the error message.

I have tested extensively on my system and a testing partner's system. Any
ideas?
 
H

Helmut Obertanner

Hello Karen,

can you test on your client system with a little vbs script if you can
create a word instance ?


sav the following on a client box as "test.vbs"
------------------------------
Dim objWord
Set objWord = CreateObject("Word.Application")
objWord.Visible = true
Set objWord = Nothing
--------------------------------

Double click this file and see if word pops up ?

--
regards

Helmut Obertanner
Technical Consultant

Softwaredevelopment
DATALOG Software AG | Zschokkestr. 36 | D-80687 Munich
web: www.datalog.de


.... and IT works!
 
C

Cindy M -WordMVP-

Hi Karen,
I hope someone can help. I am using the following code from Access to open
Word. I am using late binding because potential clients have Word 2000, Word
2002 and Word 2003.You need to determine on which line the error is ocurring, although from
your description it's likely the CreateObject line. It's possible, I suppose,
that Word is not correctly registered on this system, and therefore
CreateObject is failing. If the user runs Help/Detect and Repair from within
Word - which should re-register it - does that change anything?
dim objWord as Object

On Error Resume Next

Set objWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
Set objWord = CreateObject("Word.Application")
End If

On Error GoTo Err cmdPhoto

The application is an Access 2003 .mde.

I have a client who has Word 2002 on his system. When he chooses the button
in the Access application to open Word he gets the 'Object variable not set'
message if he does not have Word open already. If he opens Word and then
minimizes it he does not get the error message.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
K

Karen

Cindy and Helmut,

I bit the bullet and have paid my support fee to work directly with the
Microsoft developer group. It does appear to have nothing to do with the
code and rather the client's systems. Only problem is that these two
clients represent 50% of the users who have the app so I'm anxious to find
if there is some sort of common system thread that can be accomodated.

--
Karen
Hi Karen,
I hope someone can help. I am using the following code from Access to
open
Word. I am using late binding because potential clients have Word 2000,
Word
2002 and Word 2003.You need to determine on which line the error is ocurring, although from
your description it's likely the CreateObject line. It's possible, I
suppose,
that Word is not correctly registered on this system, and therefore
CreateObject is failing. If the user runs Help/Detect and Repair from within
Word - which should re-register it - does that change anything?
dim objWord as Object

On Error Resume Next

Set objWord = GetObject(, "Word.Application")
If Err.Number = 429 Then
Set objWord = CreateObject("Word.Application")
End If

On Error GoTo Err cmdPhoto

The application is an Access 2003 .mde.

I have a client who has Word 2002 on his system. When he chooses the
button
in the Access application to open Word he gets the 'Object variable not set'
message if he does not have Word open already. If he opens Word and then
minimizes it he does not get the error message.
Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top