ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using a shared printer (pdf) (https://www.excelbanter.com/excel-programming/374306-using-shared-printer-pdf.html)

Steve

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)


All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com