Excel Range Converted in PDF..But No Colors

Joined
Aug 3, 2006
Messages
1
Reaction score
0
Hi All,
I build a small macro that convert a given excel range into a pdf file, with specified name and location:
Private Sub CommandButton1_Click()
' Define the postscript and.pdf file name
Dim PSFileName As String
Dim PDFFileName As String
Dim PfNbre As Long
Dim DatePf As Variant
DatePf = Workbooks("Structurer Sheet_ BackUp 31-07").Sheets("Portfolio Details").Range("C4")
DatePf = Format(DatePf, "d-mmm-yy")
PSFileName = "S:\CreditFixed Income&Trading\Credit Derivative Trading\Templates for Structuring\Stat Portfolios\Portfolio" & Workbooks("Structurer Sheet_ BackUp 31-07").Sheets("Portfolio Details").Range("A13").value & "," & DatePf & ".ps"
PDFFileName = "S:\CreditFixed Income&Trading\Credit Derivative Trading\Templates for Structuring\Stat Portfolios\Portfolio" & Workbooks("Structurer Sheet_ BackUp 31-07").Sheets("Portfolio Details").Range("A13").value & "," & DatePf & ".pdf"
'Select the range to convert
Dim i As Integer
Dim j As Integer
For i = 1 To 500
If Workbooks("Structurer Sheet_ BackUp 31-07").Sheets("Portfolio").Range("K500").offset(-i, 0).value <> 0 Then
j = 500 - i
Exit For
End If
Next i

'Acrobat Distiller
' Print the Excel range to the postscript file
Dim MySheet As Worksheet
Set MySheet = ActiveSheet

MySheet.Range("B2:O" & j & "").PrintOut Copies:=1, _
preview:=False, ActivePrinter:="Acrobat Distiller on Ne00", _
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

I use Adobe Reader 7.0.
But for some reasons, whereas the range has some colors, the pdf created is in black and white.
Thanks for helping!
Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top