ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Error 1004 in printing .ps (postscript) file from .xls file (https://www.excelbanter.com/excel-programming/290301-error-1004-printing-ps-postscript-file-xls-file.html)

chemburkar[_2_]

Error 1004 in printing .ps (postscript) file from .xls file
 
Hi,

I have a program which copies excel file to postscript .ps file.
The code works fine for small number of files.
But if I try to run it for 5,000-6,000 excel files the programs fail
throwing 1004 error.
I am guessing that it could be run time memory problem.
Could somebody suggest me solution for this?

code snippet

=========================================
ReportFileName = ReportsPath & ReportFile
Application.Workbooks.Open (ReportFileName)
PortName = Space(255)
PortName = NTS(PortName) 'NTS is function which returns por
name

'create the distiller printer name.
printer = "Acrobat Distiller on " & PortName '
strMenuFilePS = Replace(ReportFile, ".xls", ".ps")

strMenuFilePS = "E:\Test\" & strMenuFilePS

Application.ActiveWindow.SelectedSheets.PrintOu
ActivePrinter:=printer, PrintToFile:=True, PrToFileName:=strMenuFilePS

Application.ActiveWorkbook.Close
ReportFile = ""
ReportFile = Dir ' Get next entry.
==============================================


Thanks in advance

Meghan

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

Error 1004 in printing .ps (postscript) file from .xls file
 
It probably is a memory problem associated with printing. Break your
bundles of files into smaller groups (a number less than when your program
crashes). You might need to reboot between printing bundles.

--
Regards,
Tom Ogilvy

chemburkar wrote in message
...
Hi,

I have a program which copies excel file to postscript .ps file.
The code works fine for small number of files.
But if I try to run it for 5,000-6,000 excel files the programs fails
throwing 1004 error.
I am guessing that it could be run time memory problem.
Could somebody suggest me solution for this?

code snippet

=========================================
ReportFileName = ReportsPath & ReportFile
Application.Workbooks.Open (ReportFileName)
PortName = Space(255)
PortName = NTS(PortName) 'NTS is function which returns port
name

'create the distiller printer name.
printer = "Acrobat Distiller on " & PortName '
strMenuFilePS = Replace(ReportFile, ".xls", ".ps")

strMenuFilePS = "E:\Test\" & strMenuFilePS

Application.ActiveWindow.SelectedSheets.PrintOut
ActivePrinter:=printer, PrintToFile:=True, PrToFileName:=strMenuFilePS

Application.ActiveWorkbook.Close
ReportFile = ""
ReportFile = Dir ' Get next entry.
==============================================


Thanks in advance

Meghana


---
Message posted from http://www.ExcelForum.com/




chemburkar[_3_]

Error 1004 in printing .ps (postscript) file from .xls file
 
Thanks for reply.

In my case , it is not possible to break the file creation in the smal
batches.

Is is possible to free the memory in excel code only

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 10:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com