View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Mia Mia is offline
external usenet poster
 
Posts: 101
Default 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