Save to pdf and make filename

M

Mia

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
 

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