LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Converting Excel worksheet to PDF then print

You code works for me as written.

Check that appDist is actually being created properly.
Do you get the .ps file created correctly ?

NickHK

"kidkarma" wrote in message
oups.com...
Hi,
As subject suggests been tring to convert an excel sheet(with data
validation) to convert to pdf and print each time data changes on the
sheet.

ISSUES:

1)Method 'odist' of object 'cACroDist' failed.

If i step through the code though it continues and appears to work
except for

2)the fact that althougha box appears that shows that it is 'now
printing page 1 of 1', when i go to a printer nothing has actually
printed


Can anyone help me figure this. it's been killing me all day. Is there
another alternative? I';ve looked on the web but the examples seem
more complicated than what i need as I am only dealing with one
worksheet rather than trying to print out sheets in many workbooks

sorry if this hasn't made sense. Please let me know


Sub Print2PDF()

Dim sPSFileName As String 'Name of PS to be created
Dim sPDFFileName As String 'Name of PDF to be created
Dim sJobOptions As String
Dim sCurrentPrinter As String 'Same current printer choice to
resume at end
Dim sPDFVersionAndPort As String 'Version of Adobe
Dim appDist As cACroDist

Set appDist = New cACroDist
sCurrentPrinter = Application.ActivePrinter 'Save the currently
active printer
sPDFVersionAndPort = "Adobe PDF on Ne01:"
sPSFileName = ThisWorkbook.Path & "\MacroData validation" & ".ps"
'Name of PS file
sPDFFileName = ThisWorkbook.Path & "\MacroData validation" &
".pdf" 'Name of PDF
ThisWorkbook.Sheets.PrintOut ActivePrinter:=sPDFVersionAndPort, _
PrintToFile:=True, PrToFileName:=sPSFileName 'Prints to PS

Call appDist.odist.FileToPDF(sPSFileName, sPDFFileName,
sJobOptions)
'Creates PDF

Kill sPSFileName 'Removes PS

Application.ActivePrinter = sCurrentPrinter 'Change back to the
original printer

End Sub

****BELOW is a class module named cACroDist that is also included

Option Explicit

Public WithEvents odist As PdfDistiller

Private Sub Class_Initialize()
Set odist = New PdfDistiller
End Sub



Thanks in advance!



 
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
CONVERTING MS WORD FORMATTED DATA INTO EXCEL WORKSHEET NSNR Excel Discussion (Misc queries) 3 March 12th 09 09:54 PM
my excel is converting all my print jobs to print to file why? Ginger Excel Discussion (Misc queries) 2 April 10th 07 12:28 PM
Converting Excel worksheet to JPEG, PDF or TIFF pressing a cell/bu DORI Excel Worksheet Functions 1 November 30th 05 07:46 AM
Converting Excel Worksheet to PDF using VBA Thomas Cox Excel Programming 2 August 11th 05 11:48 AM
Converting Lotus 123 macro to Excel - copy/move data to worksheet Bernice[_2_] Excel Programming 7 February 12th 04 03:47 PM


All times are GMT +1. The time now is 02:45 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"