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 / November 2005

Tip: Looking for answers? Try searching our database.

Prevent print message from displaying

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JoAnn - 10 Nov 2005 14:20 GMT
I'm using PrintOut to print the document's current page to a file but don't
know how to prevent the "printing ..." message from appearing on the screen.

Is there some code I can use to suppress the message? I'm using Word 2003.
Thanks,
Signature

JoAnn

Jean-Guy Marcil - 10 Nov 2005 22:18 GMT
JoAnn was telling us:
JoAnn nous racontait que :

> I'm using PrintOut to print the document's current page to a file but
> don't know how to prevent the "printing ..." message from appearing
> on the screen.
>
> Is there some code I can use to suppress the message? I'm using Word
> 2003. Thanks,

Have you try making sure that printing to background was on?

Try this:
'_______________________________________
Dim BackGroundPrint As Boolean

'Save the current Print to background state
BackGroundPrint = Options.PrintBackground

'Make sure it is set to print in the background
If Not BackGroundPrint Then
   Options.PrintBackground = True
End If

ActiveDocument.PrintOut

'Restore the Print to background state, if necessary
If Not BackGroundPrint Then
   Options.PrintBackground = BackGroundPrint
End If
'_______________________________________
Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org 

JoAnn - 11 Nov 2005 14:17 GMT
Thank you for the suggestion but it didn't help. I still see a a brief flash
of the print message but it is then quickly replaced by an error message
saying "permission denied" when my code tries to "kill" the dummy file I
printed. Not being able to delete my dummy file is a new development since
adding your code. Your suggestion makes sense -- I don't understand why it
doesn't work & why it created a new problem.

My code is set up as Document_New and Document_Open events in ThisDocument.
I tried using Auto_Open and Auto_New (which doesn't seem to show the print
message when I print to file) but I found I couldn't delete the file that. So
I went back to using the events in ThisDocument.

Maybe I 'm going about this wrong ... all I'm trying to do is print the
current page to a file (to clear up/prevent an intermittent problem where all
of my page xrefs display "3" or "4"), not show a print message to the user
while printing & then delete the dummy file I created. Since it will be used
on different systems, it needs to be able to find the file wherever it was
created & delete it.

To print, I am using PrintOut with the PrintToFile & OutputFilename options
set (added your code to set it to background print & then turn it off when
done). To name the dummy file, I'm  using a variable built on the
Options.DefaultFilePath(wdDocumentsPath) & the hard-coded file name
"dummy_file.prn". To delete the file, I'm using Kill with the variable that
contains the full path & filename.

Any suggestions?

Thank you,
JoAnn

> JoAnn was telling us:
> JoAnn nous racontait que :
[quoted text clipped - 27 lines]
> End If
> '_______________________________________
Jonathan West - 11 Nov 2005 14:28 GMT
Setting Background:=True in the Printout method means that your macro goes
on to the next line before the creation of the print file is completed.

If you want to delete the print file or otherwise process it, you'll need to
stop & wait a while, and check whether the printing has completed. Simply
going into a loop will not do the needful - all the processor power till be
taken up by the loop leaving nothing for the printing.

To get round this, use the OnTime command to run a macro in a few seconds'
time. The macro should check the value of the BackgroundPrintingStatus
property. If it is greater than zero, the file is still printing, so you use
OnTime to run the same macro again in a few more seconds. Once
BackgroundPrintingStatus is zero then you can continue with your processing

Signature

Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org

> Thank you for the suggestion but it didn't help. I still see a a brief
> flash
[quoted text clipped - 65 lines]
>> End If
>> '_______________________________________
JoAnn - 11 Nov 2005 14:43 GMT
Thank you. I will research how to do that & add it to my code.
Signature

JoAnn

> Setting Background:=True in the Printout method means that your macro goes
> on to the next line before the creation of the print file is completed.
[quoted text clipped - 79 lines]
> >> End If
> >> '_______________________________________
JoAnn - 14 Nov 2005 17:16 GMT
Help!
I've been researching your suggestion to use OnTime & create a macro to
check the status but have gotten quite confused about how to go about it (do
loops, if statements, etc.) ... sorry I'm not a programmer and sometimes I
know just enough about VBA coding to get myself into trouble!!

Please help.  I understand about adding the statement for OnTime --- i.e.
Application.OnTime when:= Now + TimeValue("00:00:08") Name:=
"Check_Print_Status"

As for the Check_Print_Status macro ... I know I must create a var (as
long?) to store the status (i.e. pstatus =
Application.BackgroundPrintingStatus) then if the status is >0 somehow run
Ontime again until it clears. But not sure how I should be doing this  -- do
I use a do loop or if statement, etc. nesting another OnTime statement ?? I'm
confused about what code to use to ensure it repeats as often as needed
without causing an endless loop. My few attempts at different things seemed
to cause an endless loop so I dumped the code figuring I'm way off base with
the basics.

And where do I need to store the check status macro if I'm using
ThisDocument (Document New event) vs. using AutoNew?  This is used by many
users on different PCs when attached to a specific template so putting it in
normal.dot isn't an option. I was hoping to have it run when they attach to a
specific template (or if using AutoOpen/AutoNew, whenever they open or create
a new doc built off the template).

Thanks for your help!

Signature

JoAnn

> I'm using PrintOut to print the document's current page to a file but don't
> know how to prevent the "printing ..." message from appearing on the screen.
>
> Is there some code I can use to suppress the message? I'm using Word 2003.
> Thanks,

Rate this thread:






 
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.