lingering word object

D

Daniel

I exit out of wordobj using below codes. But sometime word doc pops up saying
that word doc I used using this application has been recovered, etc. Do I
need to add 'wordobj = nothing' after the last line to prevent this from
happening?

WordObj.Options.PrintBackground = False
WordObj.PrintOut Copies = 1
WordObj.Application.Quit 0

Thanks
Daniel
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RGFuaWVs?=,
I exit out of wordobj using below codes. But sometime word doc pops up saying
that word doc I used using this application has been recovered, etc. Do I
need to add 'wordobj = nothing' after the last line to prevent this from
happening?

WordObj.Options.PrintBackground = False
WordObj.PrintOut Copies = 1
WordObj.Application.Quit 0
You definitely should set the object to nothing, in any case.

But it's not said that this will stop that particular message. This indicates
that something else is wrong - Word is crashing for some reason.

From the little you show us of your code, I'm guessing

1. You've turned off errors (On Error REsume next?), so you aren't being
alerted when Word encounters a problem. *Don't DO that* It's dangerous, as
you're finding out. Code properly, find out why your getting errors and fix the
cause, don't try to sweep it under the rug. It will surely come back to haunt
you.

2. I think (1) because there is no Options property for a Word document (the
first line of code you show us)

3. You need to declare an object variable for the Word.Application and use
it properly.

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 :)
 
D

Daniel

I am using vb6 in visual studio 6. When I add 'On Error Resume Next', I am
getting a compile error 'invalid outside procedure'.

Thanks
Daniel
 
C

Cindy M -WordMVP-

Hi =?Utf-8?B?RGFuaWVs?=,
I am using vb6 in visual studio 6. When I add 'On Error Resume Next', I am
getting a compile error 'invalid outside procedure'.
then you're putting it in the wrong place. If you have so little experience,
and don't show us the code in context, there's not a lot we can do to help
you.

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