pbobadilla
10-01-2012, 08:29 AM
Hello,
I am trying to set-up a command button in a userform that will save a specific worksheet within the workbook as a pdf. I can only currently save it as the same file name (packing list) each time i create the pdf. How would I be able to save the file in the same path, but with the file name as the value in cell b1 of worksheet "Data Entry" ? Any help would be appreciated.
Here is the code I currently have:
Private Sub CommandButton1_Click()
Range("B1").Value = TextBox1
Range("C29").Value = TextBox2
Range("C30").Value = TextBox3
Range("D30").Value = TextBox4
Range("C31").Value = TextBox5
Range("E30").Value = TextBox6
Range("F31").Value = TextBox7
Range("F30").Value = TextBox8
Range("G30").Value = TextBox9
Sheets("PL-TYPE 1").Select
ChDir "P:\ShipRecv\Packing Lists"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"P:\ShipRecv\Packing Lists\packing list.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
End Sub
I am trying to set-up a command button in a userform that will save a specific worksheet within the workbook as a pdf. I can only currently save it as the same file name (packing list) each time i create the pdf. How would I be able to save the file in the same path, but with the file name as the value in cell b1 of worksheet "Data Entry" ? Any help would be appreciated.
Here is the code I currently have:
Private Sub CommandButton1_Click()
Range("B1").Value = TextBox1
Range("C29").Value = TextBox2
Range("C30").Value = TextBox3
Range("D30").Value = TextBox4
Range("C31").Value = TextBox5
Range("E30").Value = TextBox6
Range("F31").Value = TextBox7
Range("F30").Value = TextBox8
Range("G30").Value = TextBox9
Sheets("PL-TYPE 1").Select
ChDir "P:\ShipRecv\Packing Lists"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"P:\ShipRecv\Packing Lists\packing list.pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
End Sub