Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default witing for ms word to complete tasks the close

Good Morning

i am building a small code block to open word, populate with data, print and
then close.

its working fine but since the task is slow ( printing ) the word.quit
command triggers the word is currently printing .. will cancel print jobs.

i remember, or dreamt of, that this is a valida method

do
loop until not(appliactionobject.busy), but i cant find the busy property.
any workarounds ?? thank you for your help

Pedro Leite From Portugal
--------------------------------------------------------

here is the code

Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add


Dim rng As Word.Range

With wrdDoc
wrdDoc.PageSetup.Orientation = 1
Set rng = wrdDoc.Paragraphs(1).Range
rng.Font.Size = 10
rng.Font.Name = "Courier"

.Content.InsertParagraph

.Content.InsertAfter ConstruirReport
'.PrintOut
'.Content.InsertAfter "Here is a sample test line #" & i
'.Content.InsertParagraphAfter

'.Close ' close the document *//* that's the bugger
End With



wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default witing for ms word to complete tasks the close

In Word, if you go to Tools=Options, Print tab, you can check or uncheck
background printing. You would want it unchecked (don't allow background
printing). This is obviously a property that you can set with code.

--
Regards,
Tom Ogilvy


"Pedro Leite" wrote:

Good Morning

i am building a small code block to open word, populate with data, print and
then close.

its working fine but since the task is slow ( printing ) the word.quit
command triggers the word is currently printing .. will cancel print jobs.

i remember, or dreamt of, that this is a valida method

do
loop until not(appliactionobject.busy), but i cant find the busy property.
any workarounds ?? thank you for your help

Pedro Leite From Portugal
--------------------------------------------------------

here is the code

Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add


Dim rng As Word.Range

With wrdDoc
wrdDoc.PageSetup.Orientation = 1
Set rng = wrdDoc.Paragraphs(1).Range
rng.Font.Size = 10
rng.Font.Name = "Courier"

.Content.InsertParagraph

.Content.InsertAfter ConstruirReport
'.PrintOut
'.Content.InsertAfter "Here is a sample test line #" & i
'.Content.InsertParagraphAfter

'.Close ' close the document *//* that's the bugger
End With



wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default witing for ms word to complete tasks the close

Thank You Very Much



PLeite
----------------------------------------------------------------
"Tom Ogilvy" escreveu na mensagem
...
In Word, if you go to Tools=Options, Print tab, you can check or uncheck
background printing. You would want it unchecked (don't allow background
printing). This is obviously a property that you can set with code.

--
Regards,
Tom Ogilvy


"Pedro Leite" wrote:

Good Morning

i am building a small code block to open word, populate with data, print
and
then close.

its working fine but since the task is slow ( printing ) the word.quit
command triggers the word is currently printing .. will cancel print
jobs.

i remember, or dreamt of, that this is a valida method

do
loop until not(appliactionobject.busy), but i cant find the busy
property.
any workarounds ?? thank you for your help

Pedro Leite From Portugal
--------------------------------------------------------

here is the code

Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim i As Integer
Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Add


Dim rng As Word.Range

With wrdDoc
wrdDoc.PageSetup.Orientation = 1
Set rng = wrdDoc.Paragraphs(1).Range
rng.Font.Size = 10
rng.Font.Name = "Courier"

.Content.InsertParagraph

.Content.InsertAfter ConstruirReport
'.PrintOut
'.Content.InsertAfter "Here is a sample test line #" & i
'.Content.InsertParagraphAfter

'.Close ' close the document *//* that's the bugger
End With



wrdApp.Quit ' close the Word application
Set wrdDoc = Nothing
Set wrdApp = Nothing





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
display a complete list of tasks by selecting on a task matt Excel Discussion (Misc queries) 1 July 6th 09 04:32 PM
Excel can not complete this task with available resources. Choose less data or close other applications. [email protected] Excel Discussion (Misc queries) 1 November 12th 06 10:56 AM
Function to show percentage of tasks complete Mirthrindr Excel Discussion (Misc queries) 1 July 31st 06 02:14 PM
How do I add periods to complete a word in a cell? Renee R. Excel Discussion (Misc queries) 5 September 2nd 05 08:17 PM
Remove complete row containing a single word Kanga 85 Excel Worksheet Functions 4 February 23rd 05 02:23 AM


All times are GMT +1. The time now is 04:08 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"