473,224 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,224 software developers and data experts.

MS Word and Printing

I have my Word document being created in a seperate thread. THe applicaiton
is not visible.

The end user can choose to view the document upon completion or just have it
print.

Viewing is fine.

If htey choose to "just print it" it seems ot ignore this command:

oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)

and a prompt appears asking that it wait until printing is complete. I
beleive it is because it is getting to my "kill thread" command at that
point.

In addition when I ask that it cancel the print job in the Word dialog that
appears, something like a print preview screen appears. (I use MS Word
2003). Then the save file dialog appears

Is there a way to just offer to save it, print it, and kill the thread
without this inteference from Word? I am probably missing something here.

I need this to work with Office 2000 and up.....

oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
OfficeThread.IsBackground = False
oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
Try
OfficeThread.IsBackground = True
Label28.Text = "Printing Report..."
Label28.Refresh()
OfficeThread.IsBackground = False
oDoc.Application.PrintOut()
OfficeThread.IsBackground = True
oDoc.Application.Quit()
OfficeThread.Abort()
Nov 20 '05 #1
4 2040
Hi 53061

If the code you've posted is what you're executing you've got a problem
sure enough. The statement:
oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)

is invalid! And since it's outside your Try block the Catch exception
handler is not grabbing it! Try using:

oDoc.Application.Dialogs.Item(wdDialogFileSaveAs). Show

or if you have the Word applicat object rather than the document object
use:
wdApp.Dialogs.Item(wdDialogFileSaveAs).Show

HTH + Cheers - Peter
"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
news:#L**************@TK2MSFTNGP11.phx.gbl:
I have my Word document being created in a seperate thread. THe
applicaiton is not visible.

The end user can choose to view the document upon completion or just
have it print.

Viewing is fine.

If htey choose to "just print it" it seems ot ignore this command:

oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)

and a prompt appears asking that it wait until printing is complete. I
beleive it is because it is getting to my "kill thread" command at that
point.

In addition when I ask that it cancel the print job in the Word dialog
that appears, something like a print preview screen appears. (I use MS
Word 2003). Then the save file dialog appears

Is there a way to just offer to save it, print it, and kill the thread
without this inteference from Word? I am probably missing something
here.

I need this to work with Office 2000 and up.....

oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
OfficeThread.IsBackground = False
oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
Try
OfficeThread.IsBackground = True
Label28.Text = "Printing Report..."
Label28.Refresh()
OfficeThread.IsBackground = False
oDoc.Application.PrintOut()
OfficeThread.IsBackground = True
oDoc.Application.Quit()
OfficeThread.Abort()


Nov 20 '05 #2
Also check out the arguments of the PrintOut command. Set the background
argument to False so that the balance of your code does not execute until
the printing is complete.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
I have my Word document being created in a seperate thread. THe applicaiton
is not visible.

The end user can choose to view the document upon completion or just have
it
print.

Viewing is fine.

If htey choose to "just print it" it seems ot ignore this command:

oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)

and a prompt appears asking that it wait until printing is complete. I
beleive it is because it is getting to my "kill thread" command at that
point.

In addition when I ask that it cancel the print job in the Word dialog
that
appears, something like a print preview screen appears. (I use MS Word
2003). Then the save file dialog appears

Is there a way to just offer to save it, print it, and kill the thread
without this inteference from Word? I am probably missing something here.

I need this to work with Office 2000 and up.....

oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
OfficeThread.IsBackground = False
oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
Try
OfficeThread.IsBackground = True
Label28.Text = "Printing Report..."
Label28.Refresh()
OfficeThread.IsBackground = False
oDoc.Application.PrintOut()
OfficeThread.IsBackground = True
oDoc.Application.Quit()
OfficeThread.Abort()

Nov 20 '05 #3
ok, by setting it to false it did this correctly. Thanks...

The save file prompt occurs when the application is exiting - how do you
suppress that?
"Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS"
<dk*@mOSTvALUABLEpROFESSIONALs.org> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...
Also check out the arguments of the PrintOut command. Set the background
argument to False so that the balance of your code does not execute until
the printing is complete.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
I have my Word document being created in a seperate thread. THe applicaiton is not visible.

The end user can choose to view the document upon completion or just have it
print.

Viewing is fine.

If htey choose to "just print it" it seems ot ignore this command:

oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)

and a prompt appears asking that it wait until printing is complete. I
beleive it is because it is getting to my "kill thread" command at that
point.

In addition when I ask that it cancel the print job in the Word dialog
that
appears, something like a print preview screen appears. (I use MS Word
2003). Then the save file dialog appears

Is there a way to just offer to save it, print it, and kill the thread
without this inteference from Word? I am probably missing something here.
I need this to work with Office 2000 and up.....

oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
OfficeThread.IsBackground = False
oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
Try
OfficeThread.IsBackground = True
Label28.Text = "Printing Report..."
Label28.Refresh()
OfficeThread.IsBackground = False
oDoc.Application.PrintOut()
OfficeThread.IsBackground = True
oDoc.Application.Quit()
OfficeThread.Abort()


Nov 20 '05 #4
Hi

Set the Document objects Saved property to True.

HTH + Cheers - Peter

"scorpion53061" <Its the end of the world as we know it@here.com> wrote in
news:e#**************@TK2MSFTNGP11.phx.gbl:
ok, by setting it to false it did this correctly. Thanks...

The save file prompt occurs when the application is exiting - how do you
suppress that?
"Doug Robbins - Word MVP - DELETE UPPERCASE CHARACTERS FROM EMAIL ADDRESS" <dk*@mOSTvALUABLEpROFESSIONALs.org> wrote in message
news:em**************@TK2MSFTNGP09.phx.gbl...
Also check out the arguments of the PrintOut command. Set the background
argument to False so that the balance of your code does not execute until the printing is complete.

--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded directly to me will only be answered on a paid consulting basis.
Hope this helps
Doug Robbins - Word MVP
"scorpion53061" <Its the end of the world as we know it@here.com> wrote in message news:%2****************@TK2MSFTNGP11.phx.gbl...
>I have my Word document being created in a seperate thread. THe

applicaiton > is not visible.
>
> The end user can choose to view the document upon completion or just have > it
> print.
>
> Viewing is fine.
>
> If htey choose to "just print it" it seems ot ignore this command:
>
> oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
>
> and a prompt appears asking that it wait until printing is complete. I
> beleive it is because it is getting to my "kill thread" command at that > point.
>
> In addition when I ask that it cancel the print job in the Word dialog
> that
> appears, something like a print preview screen appears. (I use MS Word
> 2003). Then the save file dialog appears
>
> Is there a way to just offer to save it, print it, and kill the thread
> without this inteference from Word? I am probably missing something here. >
> I need this to work with Office 2000 and up.....
>
> oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
>
>
> OfficeThread.IsBackground = False
> oDoc.Application.Dialogs.Item(wdDialogFileSaveAs)
> Try
> OfficeThread.IsBackground = True
> Label28.Text = "Printing Report..."
> Label28.Refresh()
> OfficeThread.IsBackground = False
> oDoc.Application.PrintOut()
> OfficeThread.IsBackground = True
> oDoc.Application.Quit()
> OfficeThread.Abort()
>
>




Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Stefania Scott | last post by:
I am trying to print a word document from Access. The code I've written works well in my computer but does not in the one were it is needed. Here the piece of code: 'doc path strObjectPath =...
10
by: Jeff B. | last post by:
Has anyone come across a decent algorithm for implementing word wrap features in .net printing? I have a small component that uses basic printing techniques (i.e. e.Graphics.DrawString in a...
0
by: Karthik | last post by:
Well I am coding an application using C# for my company which requires multiple printing of Crystal Report Docs & Word Docs, at a specific Printer of the installed Printers in the network, at a...
8
by: ljungers | last post by:
Wondering if somone knows how to open a Access report in Word or export it to Word. Currently I'm opening and printing a report using VBA with the following command (DoCmd.OpenReport "TheReportName",...
1
by: Laurent Navarro | last post by:
Hi, I created a C# application which opens a Word document, fills some fields and sends the whole document to the printer. Everything is working great but I find the printing step very slow....
2
by: madval | last post by:
hi, i need your help, i'll receive some ms word documents (paragraphs, bullets, different fonts in a document -family-size-format, images, etc. a "normal" document) and i need to print them on a...
1
by: belinda | last post by:
I have used the ff command but only get the date printout and have no clue whats wrong: 'Printing function ' - opening a Word template with bookmarks ' - read bookmarks list from template and...
1
by: Derek Hart | last post by:
I have a vb.net winforms application that loops through several thousand word documents and prints them, with the filenames being read from a SQL database. I am using late bound code to load MS...
0
by: corcoranj | last post by:
Hello everyone, I have a series of Microsoft word documents, gathered via a SQL query. I would like to be able to print these documents, no matter the number to the clients computer. I have tried...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.