Problem with printing Excel
I'm having problems with my Excel DDE printing.
If I call the function bellow more that one time it gives me the following message.
[Run-time error 1004: Method 'PrintOut' of object 'Sheets' failed]
It prints fine the first print job, and then crashes on the next print job. It is
as if there is an object or maybe a registry variable that must be released.
Also, the printer that it is printing to is a printer driver with it's port set to FILE.
Private Sub WritePS(sfile As String)
Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Set oWB = oXL.Workbooks.Open(App.Path & "\original\" & sfile & ".xls")
oXL.Visible = True
oXL.UserControl = False
oXL.Application.DisplayAlerts = False
oXL.ActiveWindow.SelectedSheets.PrintOut _
ActivePrinter:="PostScript Writer", _
PrToFileName:=App.Path & "\postscript\" & sfile & ".ps"
oXL.Quit
Set oWB = Nothing
Set oXL = Nothing
End Sub
Thank you
Beans4You
[email protected]