PC Review


Reply
Thread Tools Rate Thread

Bulding pdf-files with vba and acrobat 6.0

 
 
Martin Beering
Guest
Posts: n/a
 
      6th Nov 2003
Hallo to all,

since hours I am trying to create pdf-files with vba and acrobat 6.0.
I would like to pass the path and filename by a variable. But it dosn't
work.
Has anyone an idea how I can do this.

Many thanks in advane and greetings from Bremen (Germany)
Martin Beering


 
Reply With Quote
 
 
 
 
Dan E
Guest
Posts: n/a
 
      6th Nov 2003
Martin,

I can remember having trouble's automating the PDF printing.
Though I can't remember exactly what they were. I found this
macro on somebodies site and it works well...

Private Sub CommandButton1_Click()
' Define the postscript and .pdf file names.
Dim PSFileName As String
Dim PDFFileName As String
PSFileName = "c:\myPostScript.ps"
PDFFileName = "c:\myPDF.pdf"


' Print the Excel range to the postscript file
Dim MySheet As Worksheet
Set MySheet = ActiveSheet
ActiveSheet.PrintOut copies:=1, preview:=False, ActivePrinter:="Acrobat Distiller", printtofile:=True, collate:=True,
prtofilename:=PSFileName


' Convert the postscript file to .pdf
Dim myPDF As PdfDistiller
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

Kill (PSFileName)

End Sub

You can have it prompt for a save as name by changing
PDFFileName = "c:\myPDF.pdf" 'to:
PDFFileName = Application.GetSaveAsFilename

Note: Works on Acrobat 5. I won't make any guarantees about 6
Watch out for word wrap on the code

Dan E

"Martin Beering" <(E-Mail Removed)> wrote in message news:boe8ck$386$05$(E-Mail Removed)...
> Hallo to all,
>
> since hours I am trying to create pdf-files with vba and acrobat 6.0.
> I would like to pass the path and filename by a variable. But it dosn't
> work.
> Has anyone an idea how I can do this.
>
> Many thanks in advane and greetings from Bremen (Germany)
> Martin Beering
>
>



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help Bulding a Complex QBF using list boxes =?Utf-8?B?U2ltcGx5IERldmluZQ==?= Microsoft Access Form Coding 5 13th Aug 2007 10:06 PM
Bulding expressions in views Jose Perdigao Microsoft Access ADP SQL Server 14 8th Feb 2006 06:04 AM
how do I convert abode acrobat files to microsoft word files? =?Utf-8?B?UmljaGFyZCBTaW1z?= Microsoft Word Document Management 2 20th Jul 2005 05:09 AM
Error when bulding Image Mkr Windows XP Embedded 7 5th Jul 2005 07:25 PM
bulding control names on the fly Santiago Gomez Microsoft Access Forms 1 8th Dec 2003 05:25 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:56 AM.