Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Application-defined or object-defined error" while printing excel report


I am creating a .pdf file from excel file The code works fine for smal
number of files ,but for 5,000-6,000 files the VBA code fails givin
error 1004
"Application-defined or object-defined error"

Here is the code snippet

'runs macro in xls file
Call runMacro()

'create postscript file (1)
Application.ActiveWindow.SelectedSheets.PrintOu
ActivePrinter:=printer, PrintToFile:=True, PrToFileName:=PSFileName

Dim PDFFileName AS String
'get pdf file name (2)
PDFFileName = publishInfo.publishReportPath & Filename


Dim PdfDistillerObj As Object
Set PdfDistillerObj = CreateObject("PdfDistiller.PdfDistiller.1")

' create the pdf report from the ps report.
PdfDistillerObj.FileToPDF strMenuFilePS, PDFFileName , ""
Set PdfDistillerObj = Nothing


If I run it in the debug mode
The code completes (1) and creates .ps file but before reaching (2
i.e. before creating the PDF filename it fails giving 1004 error

I am guessing that it could be memory issue as it fails only for larg
number of files, but not sure.

Any help appreciated.
Thanks in advnace

Meghan

chemburka
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message353955.htm

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
Run-time error '50290': Application-defined or object-defined erro Macro button Excel Discussion (Misc queries) 1 March 12th 09 10:59 AM
Application-defined or object-defined error Please Help [email protected] Excel Discussion (Misc queries) 1 April 3rd 06 01:00 PM
"Run Time Error 1004 Application Defined or Object Defined Error." BJC Excel Programming 4 October 26th 03 03:09 AM
Application-defined or object-defined error jaf Excel Programming 0 September 8th 03 07:01 PM
Runtime Error 1004 -- Application Defined or Object Defined Error John[_51_] Excel Programming 3 September 4th 03 04:28 PM


All times are GMT +1. The time now is 09:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"