P
Pedro Leite
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
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