View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Steve Steve is offline
external usenet poster
 
Posts: 1,814
Default using a shared printer (pdf)

Below is the code I am using to print a worksheet to pdf, and save it, all in
vba. For this to work, I have to turn off the option that says: Do not send
fonts to "Adobe PDF". Is there a way to check this option with vba?

I have shared this printer across a network (all users running windows xp).
Then I shared the file containing the code below. when i run it from someone
else's computer, I get an error that there may be a firewall. What do I need
to do?

CODE:
Dim PSFileName As String, PDFFileName As String
Dim myPDF As PdfDistiller, x As String, y As String, wb As Workbook

Set wb = ActiveWorkbook
Application.ActivePrinter = "\\DANS\Adobe PDF on Ne05:"

If wb.Path = "" Then
MsgBox "this file has to be saved first"
Exit Sub
End If

x = ThisWorkbook.Path & "\Save Sheet as PDF" & "\"
y = Left(wb.Name, Len(wb.Name) - 4)

PSFileName = x & y & ".ps"
PDFFileName = x & y & ".pdf"

wb.PrintOut , prtofilename:=PSFileName
Set myPDF = New PdfDistiller
myPDF.FileToPDF PSFileName, PDFFileName, ""

On Error Resume Next
Kill Left(PSFileName, Len(PSFileName) - 2) & "log"
Kill (PSFileName)