Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

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
file format or file extension is not valid...error message Ballun Excel Discussion (Misc queries) 0 May 7th 09 09:06 PM
Open Excel file get error with file names that have spaces in the Kozmo Setting up and Configuration of Excel 6 October 29th 08 02:51 AM
"Unable to read file" error message when opening a Excel file that contains a PivotTable report. Tim Marsden Charts and Charting in Excel 2 October 15th 05 02:10 PM
Error 1004 when I open a file Deer Hunter Excel Programming 3 August 27th 03 05:33 PM
runtime error 1004 when opening excel file via VBA in a browser Ken Hunter Excel Programming 2 July 31st 03 03:33 PM


All times are GMT +1. The time now is 07:21 AM.

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"