Save As, PDF, Filename, File location

Krosis

New Member
Joined
Sep 10, 2021
Messages
23
Office Version
  1. 365
Platform
  1. Windows
I have had a look around and have founds bit but I was unable to put anything together. I dont know VBA/userforms well enough to figure it out myself so once again, iv come for expert advice!
Apologies but I dont have any code to post as I wasnt even sure where to start.

I need help with figuring out how to code a MacroButton located on my worksheet that the client will select. Im wanting to MacroButton to bring up the Save As option, Set the file location, Filename (based on 3 Cell values) and set the document to save as a PDF format so all the client has to do is confirm the details and hit save.

What I mean by the file name being based on 3 cell values is... I need it to display as "Name - ID - Outcome" but based on... Cell B4 = "Name", Cell H4 = "ID" and Cell A9 = "Outcome".

Hopefully all that makes sense!.. If not give me a shout. Hopefully someone can help. Thanks!
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
Try this

VBA Code:
Sub SavePDF()

' Save Calculation as PDF

Dim x As String
x = Range("C5").Value  ' Change This cell to Cell Loction for which you need file to be saved as


' Change location as per your requirement :C:\Users\Test\Desktop\

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\Users\Test\Desktop\" & x & ".pdf", Quality:=xlQualityMinimum, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
        False
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,454
Messages
6,124,931
Members
449,195
Latest member
Stevenciu

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