VBA Save sheet as PDF

Опубликовано: 26 Июнь 2026
на канале: Kevin Brundu
3,807
17

Save a sheet to a PDF file.

Code:
Sub save_sheet_in_pdf()

'save a worksheet as a PDF file

Dim ws_sheet As Worksheet
Dim name_PDF As String
Dim path_PDF As String

'Identify name of the PDF file to create
name_PDF = "My PDF.pdf"

'Identify path of the PDF to create
path_PDF = "C:\Users\brunduk\Documents\Tutorials\" & name_PDF

'identify sheet to save as PDF
Set ws_sheet = Worksheets("Sheet5")

'select sheet
ws_sheet.Select

'create PDF
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=path_PDF, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False

End Sub

-------------------------------
THANK YOU
-------------------------------
For watching my videos,
Your shares
And your comments!

-------------------------------
CONTACT ME
-------------------------------
Send your messages (questions, training requests or creation of files): https://www.kevinbrundu.com/contact/
Stay informed: https://kevinbrundu.com/en/homepage

-------------------------------
ONLINE COURSES
-------------------------------
Find all the news and links of my online courses on my website https://kevinbrundu.com/en/homepage

-------------------------------
SOCIAL NETWORKS
-------------------------------
Website: https://kevinbrundu.com/en/homepage
LinkedIn:   / k%c3%a9vin-brundu-9a910241  
Facebook:   / kevinbrunduauteur  

-------------------------------
MERCI
-------------------------------
De regarder mes vidéos,
Pour vos partages
Et vos commentaires !

-------------------------------
RENDEZ-VOUS SUR MON SITE INTERNET
-------------------------------
https://www.kevinbrundu.fr/

Retrouvez y :
Des fichiers Excel à télécharger gratuitement
Mes formules clés en main sur Excel avec des fichiers prêts à l'emploi
Mes services de Consultant Optimisation, Performance et Génération d'idées

-------------------------------
AUTRES RESSOURCES EN LIGNE
-------------------------------
Livres publiés : https://www.amazon.fr/Kévin-Brundu/e/...
Cours en ligne sur Udemy :
VBA Macro Excel - Formulaire simplifié sur une feuille Excel https://www.udemy.com/course/macro-ex...

VBA Macro Excel - Compiler des fichiers dans un seul tableau https://www.udemy.com/course/macro-ex...

Suivez toutes les actualités sur mon site internet directement.

-------------------------------
DES QUESTIONS ?
-------------------------------
Laissez vos questions en commentaires ou contactez-moi directement via mes réseaux sociaux.

-------------------------------
RESEAUX SOCIAUX
-------------------------------
Pour en savoir plus sur moi et me contacter :
Site internet : https://www.kevinbrundu.fr/
LinkedIn :   / k%c3%a9vin-brundu-9a910241