multiple word instances even after....

M

M.L.Srinivas

Hi,

Why multiple instances of word are generated even after
using the following code:

On error resume next
set wordapp=getobject(,"word.application")
if wordapp is nothing then
set wordapp=createobject("word.application")
end if

I believe this code when executed should check whether
word is already opened or not and if opened use the
current instance or else create a new instance.

But still i'm getting multiple instances. And I think this
happens only with windows 98 and office 97.

Please show me a way out.

Thanks

M.L.Srinivas
 
Å

Åsa Holmgren

If you dont declare the variable "wordapp" as "Object" it will be "Empty"
not "Nothing" after the "GetObject" function.

So, just add "Dim wordapp As Object" before "Set wordapp = GetObject(,
"Word.Application")" or replace "If wordapp Is Nothing Then" with "If
IsEmpty(wordapp) Then".

/Asa H
 
M

M.L.Srinivas

I didn't give declaration section but i declared
Dim Wordapp as word.application.

Definitely declaration is not the problem as it works
fine with NT and 2000. The problem is with win 98.

And also even after wordapp.quit and set wordapp=nothing
some times the object will get closed.

confusing.

M.L.Srinivas
 

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