SetPrintBackground throws exception on Office 2007

D

Dinesh Ahuja

I am facing a problem with office word automation API SetPrintbackground.I am
trying to print a word document through word automation and trying to call
this API as SetPrintBackground(FALSE).I am executing word application in
Background.Its not visible to the user.
I am facing following two problems
1. This API is throwing an exception incase of WinXP + Office 2007 and
Windows VISTA + Office 2007.This behavior is inconsistent. All other
combinations are working fine.
2. This API is used for Displaying the Printing dialog box while printing is
in Progress.
In all other cases where no exception is thrown, no matter whatever value is
set using this API "'TRUE" or "False", print dialog box is displayed while
printing is in progress.

Anyone can please tell me if they have faced any such problem and what is
the solution for this.

Thanks in Advance,
Regards
Dinesh
 
S

Steve Rindsberg

Dinesh Ahuja said:
I am facing a problem with office word automation API SetPrintbackground.I am
trying to print a word document through word automation and trying to call
this API as SetPrintBackground(FALSE).I am executing word application in
Background.Its not visible to the user.

Have a look at Word's help on PrintBackground, which allows you to set the
option you see when you manually visit the Tools, Options dialog, Print Tab,
printing option, about which help says this:

"Background printing Prints documents in the background, allowing you to
continue to work while you print. This option uses more available memory. If
printing becomes unacceptably slow, clear this option."

Changing this setting has no effect on whether Word or its dialogs are visible,
it just changes whether Word implements its own print spooling. Turning it on
can cause problems, and if memory serves, the option's no longer available in
2007; that might be why you're getting errors when trying to set it.

No matter. It won't do what you're after, so there's no need to change it.
 
D

Dinesh Ahuja

Steve:

Thanks for Answering
<<
"Background printing Prints documents in the background, allowing you to
continue to work while you print. This option uses more available memory. If
printing becomes unacceptably slow, clear this option."
But additionally it also says it allows you to work on the same document
while the printing is getting executed in background.In short this makes word
application printing operation from modless to modal application or Vice
Versa.

<<
it just changes whether Word implements its own print spooling.
I agree with Spooling point.

<<
Changing this setting has no effect on whether Word or its dialogs are
visible,This setting has effect on Word Dialogs.If word is launched in Visible Mode
then SetprintBackgroud(FALSE) displays the print dialog in front of word
application and user cannot quit application while the printing is in
progress.(Try using print for Large Size document)
If SetPrintbackground(TRUE) then print dialog is displayed in Background.So
user can click on the Close[X] in word application.

<<<
the option's no longer available in
2007; that might be why you're getting errors when trying to set it.

This option is very much avaialble in Office 2007.Click on Print option from
menu.Go to "Word Options" , Click on Advanced and refer to Print.
And this option is effective as well.I have tried it on my Application.

So My problem and question is still the same.
Do you have any idea about it.
Please provide me some valuable feedback.


Thanks in Advance and Regards
Dinesh
 
S

Steve Rindsberg

Steve:

Thanks for Answering
<<
"Background printing Prints documents in the background, allowing you to
continue to work while you print. This option uses more available memory. If
printing becomes unacceptably slow, clear this option."

But additionally it also says it allows you to work on the same document
while the printing is getting executed in background.

Yes, that's what background printing *is*.
In short this makes word
application printing operation from modless to modal application or Vice
Versa.

Yes, that makes sense.
Changing this setting has no effect on whether Word or its dialogs are
visible,This setting has effect on Word Dialogs.If word is launched in Visible Mode
then SetprintBackgroud(FALSE) displays the print dialog in front of word
application and user cannot quit application while the printing is in
progress.(Try using print for Large Size document)
If SetPrintbackground(TRUE) then print dialog is displayed in Background.So
user can click on the Close[X] in word application.

What if Word is launched but not made visible though?
This option is very much avaialble in Office 2007.Click on Print option from
menu.Go to "Word Options" , Click on Advanced and refer to Print.
And this option is effective as well.I have tried it on my Application.

Ah, thanks for that.

This may then be a bug in Word or its implementation of VBA or how it's exposed the
object model to external control. It wouldn't be the first in Office 2007.
 

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