Auto save as pdf by having file name as sheet name in Excel VBA Macro

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
205
Office Version
  1. 2019
Platform
  1. Windows
I have 27 sheets in an Excel file and file name is blank.xlsm. Except the sheet name COUNT and RAW DATA, I want that all other sheets to be save as PDF in the address
C:\Users\jyotirmaya\Desktop\Macro by using file name as Sheet name, all other 25 sheets have unique names. I have data from Column A to H and the sheets need to save as pdf from 1st row to till the last row where data is available.

kindly help with the code
 
Hi All,

I am trying to make a more efficient excel invoicing processes for a sole trader. I've set up the invoice and have a few macros that I need to add, however, the one I am struggles with most is exporting the invoice to a specific folder and also a specific file name.

I may have the file path sorted but the the aim for my file name is for it to save as: Inv Inv# - Client name
Inv# is cell C8 and my client name cell is A11.

I have googled so many ways and no way works, I suspect the issue being how want to name my file (have gone through many combinations).

This is my current have attempt:

Sub SAVE_PDF()
'
' SAVE_PDF Macro
'

'
Range("invoice").Select
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"/Users/jean-mari/Documents/Documents/Allan/Company/Invoices/"Inv"\" & Range("c8").Value "\"& Range("a11").Text & ".pdf", Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
False
End Sub
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

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