ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save to pdf and make filename (https://www.excelbanter.com/excel-programming/412727-save-pdf-make-filename.html)

Mia

Save to pdf and make filename
 
I'm trying to make the macro to atumaticly give the pdf-file a name and
to save it were I want. Do anyone know howe to do this?
I'l be wery grateful.

I have strated with this:


Sub SaveAsPDF()


Dim WO As String
Dim Track As String
Dim Filename As String

Dim str As String

Dim strNetworkPrinter As String
str = Application.ActivePrinter

WO = Worksheets("Blad1").Range("F2")
Track = Worksheets("Blad1").Range("F3")

strNetworkPrinter = GetFullNetworkPrinterName("Adobe PDF")

Filename = "F:\Test\ " & WO & " S-" & "@" & " " & Track & ".PDF"

If Len(strNetworkPrinter) 0 Then
Application.ActivePrinter = strNetworkPrinter


ActiveWindow.SelectedSheets.PrintOut


End If

Application.ActivePrinter = str

End Sub










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

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