Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2005

Tip: Looking for answers? Try searching our database.

lingering word object

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 07 Jul 2005 14:52 GMT
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
Cindy M  -WordMVP- - 08 Jul 2005 15:44 GMT
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
[quoted text clipped - 4 lines]
>        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 :-)
Daniel - 11 Jul 2005 17:31 GMT
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

> Hi =?Utf-8?B?RGFuaWVs?=,
>
[quoted text clipped - 33 lines]
> This reply is posted in the Newsgroup; please post any follow question or reply
> in the newsgroup and not by e-mail :-)
Cindy M  -WordMVP- - 12 Jul 2005 15:18 GMT
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 :-)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.