The Operation Failed. An object could nt be found.

K

Kevin Davis

Hello,

When I try to print from the document, I get a -2147221233 The
operation failed. An object could not be found. The code is below.

Sub cmdPrint_Click()
Dim oWordApp
Dim oDoc
Dim bolPrintBackground

if bSendtoTemplate(oWordApp,oDoc) then
'Send to printer

On Error resume next
bolPrintBackground = oWordApp.Options.PrintBackground
'Turn Background printing off
oWordApp.options.PrintBackground = False
'Print Document
oDoc.PrintOut

Select Case Err.Number
Case 0
Case Else
MsgBox "Printer not found. Please make sure you have a default
printer. ", 64, gsTITLE
End Select
'oDoc.Show
'Restore Previous settings
oWordApp.options.PrintBackground = bolprintBackground
'close without saving changes
oDoc.Close 0
'Close word instance
oWordApp.quit

'Clean Up
Set odoc = nothing
Set owordapp = nothing
End if

End Sub


Thank you,
Kevin Davis
 

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