View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
pete451f pete451f is offline
external usenet poster
 
Posts: 1
Default vb Excel to PDF in Acrobat 6 - need help


I have an Excel XP macro to convert excel worksheets to PDF which worke
well with Acrobat 5 and Excel XP, but stopped working in an Excel 200
and Acrobat 6 enviroment.
the script is:
***
Private Sub Workbook_Open()
'refresh data of the whole workbook
ActiveWorkbook.RefreshAll
Dim PSFileName As String 'define Post script file name
PSFileName = Left(ActiveWorkbook.FullName
(Len(ActiveWorkbook.FullName) - 4)) & ".ps"
' Print the active workbook to the postscript file using Acroba
Distiller (printer driver)
ActiveWorkbook.PrintOut copies:=1, preview:=False
ActivePrinter:="Acrobat Distiller", _
printtofile:=True, collate:=True, prtofilename:=PSFileName
' Convert the postscript file to .pdf *** reamrks, to work, in eac
workbook, need to reference
'Acrobat Distiller in Excel VB editor: tools-reference-check 'Acroa
Distiller'
Dim myPDF As ACRODISTXLib.PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

ThisWorkbook.Saved = True

End Sub
***
I move the same Excel file to a workstation with Arobat 6 and Offic
2003 installed. The same script does not work any more. The first ste
to create postscript file worked. The second step to convert .ps to PD
got an error.
The statement: [Set myPDF = New PdfDistiller] got runtime error 429
activeX component can’t create object.

I noticed after installed Acrobat 5, there are two printers installed
Acrobat PDFWriter and Arobat Distiller. While after Acrobat
installed, there is only one printer installed which is Adobe PDF.
After Acrobat 6 installed, I unchecked all 6 selections in th
‘printing preference’ of the Acrobat 6 ‘Adobe PDF’ printer. That’s al
I changed with the Acrobat 6 environment.

I searched on the web and did not find related solutions. Appreciat
anyone can help. Thanks.
:confused

--
pete451
-----------------------------------------------------------------------
pete451f's Profile: http://www.excelforum.com/member.php...fo&userid=1573
View this thread: http://www.excelforum.com/showthread.php?threadid=27294