Saving PDF via userform, and not GetSaveAsFilename

Wicked_

Board Regular
Joined
Jun 5, 2018
Messages
81
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.
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top