473,406 Members | 2,816 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,406 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 2051
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.