Hi.
I'm looking a way to save a sheet as PDF in a custom way.
Today, i got a button that makes me select folder and write a name and done!
(code below)
Private Sub CommandButton1_Click()
pdfName = ActiveSheet.Range("T1")
ChDir "O:\Mask\Verkt\A20\Measure"
fileSaveName = Application.GetSaveAsFilename(pdfName, _
FileFilter:="PDF Files (*.pdf), *.pdf")
If fileSaveName <> False Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
fileSaveName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
End If
MsgBox "File Saved to" & " " & fileSaveName
End Sub
But i've created a userform (to make every user have the same result)
(screenshot below)
https://imgur.com/a/y1n7pU5
What i want is:
You type in what needs to be typed in in the TextBox (example: 01)
Then with the Browse Save Location, the user selects the folder they want, then press save, and the file will be created at the destination.
But the tricky part is.
I want it so that the PDF name will automaticly be: Texbox1(number they enter) - Name of the user (sheet1, Cell A26), and if they press the Wreck checkbox, it will be Textbox1 - B - Name (Where it writes "B" if checkbox is checked)
Is there anyone that could help me with this code ?
Thanks in advance.
I'm looking a way to save a sheet as PDF in a custom way.
Today, i got a button that makes me select folder and write a name and done!
(code below)
Private Sub CommandButton1_Click()
pdfName = ActiveSheet.Range("T1")
ChDir "O:\Mask\Verkt\A20\Measure"
fileSaveName = Application.GetSaveAsFilename(pdfName, _
FileFilter:="PDF Files (*.pdf), *.pdf")
If fileSaveName <> False Then
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
fileSaveName _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False
End If
MsgBox "File Saved to" & " " & fileSaveName
End Sub
But i've created a userform (to make every user have the same result)
(screenshot below)
https://imgur.com/a/y1n7pU5
What i want is:
You type in what needs to be typed in in the TextBox (example: 01)
Then with the Browse Save Location, the user selects the folder they want, then press save, and the file will be created at the destination.
But the tricky part is.
I want it so that the PDF name will automaticly be: Texbox1(number they enter) - Name of the user (sheet1, Cell A26), and if they press the Wreck checkbox, it will be Textbox1 - B - Name (Where it writes "B" if checkbox is checked)
Is there anyone that could help me with this code ?
Thanks in advance.