Hi, the following code saves the active worksheet as the name specified in the code to the designated folder.
How could I make the code to save the sheet with the cell content of cell "A2"
Any help on this would be kindly appreciated.
Thanks in advance.
How could I make the code to save the sheet with the cell content of cell "A2"
Code:
[COLOR=#e56717][B]Sub[/B][/COLOR] ConvertExcel2PDF()[COLOR=#008000]
[/COLOR]
[COLOR=#151b8d][B]Dim[/B][/COLOR] sFilePathnName [COLOR=#151b8d][B]As[/B][/COLOR] [COLOR=#f660ab][B]String[/B][/COLOR]
[COLOR=#8d38c9][B]With[/B][/COLOR] ActiveWorkbook
[COLOR=#008000]' Current Excel file Location and File name to Save as PDF File:
[/COLOR] sFilePathnName = .Path & Application.PathSeparator & Left(.Name, Len(.Name) - 4) & [COLOR=#800000]"pdf"[/COLOR]
[COLOR=#008000]' Set your custom Location and File name to Save as PDF File like this:
[/COLOR] [COLOR=#008000]'sFilePathnName = "C:\MyFolder\MyFile.pdf"
[/COLOR]
[COLOR=#008000]' Conversion Code...
[/COLOR] .ExportAsFixedFormat _
[COLOR=#151b8d][B]Type[/B][/COLOR]:=xlTypePDF, _
Filename:=sFilePathnName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=[COLOR=#00c2ff][B]True[/B][/COLOR], _
IgnorePrintAreas:=[COLOR=#00c2ff][B]False[/B][/COLOR], _
OpenAfterPublish:=[COLOR=#00c2ff][B]True[/B][/COLOR]
[COLOR=#8d38c9][B]End[/B][/COLOR] [COLOR=#8d38c9][B]With[/B][/COLOR]
MsgBox [COLOR=#800000]"File converted successfully"[/COLOR], vbInformation, [COLOR=#800000]"sample"[/COLOR]
[COLOR=#8d38c9][B]End[/B][/COLOR] [COLOR=#e56717][B]Sub[/B][/COLOR]
Thanks in advance.