The Wayback Machine - https://web.archive.org/web/20250312154706/https://www.geeksforgeeks.org/how-to-convert-multiple-powerpoint-files-into-pdf-with-excel-vba/
Open In App

How to Convert Multiple PowerPoint Files Into Pdf with Excel VBA?

Last Updated: 21 Dec, 2022
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

Often clients need PPT files as PDFs.  It helps to view on any device.  Use below VBA Macro to convert PowerPoint files from a folder and save them as PDF in the same folder.

Implementation:

Follow the below steps to convert multiple PowerPoint files into PDFs using Excel VBA:

Step 1: Open Excel.

Step 2: Type text “Folder Path” in cell “B5” (Image 1).

Step 3: Enter your folder full path in cell “C5”  (Image 1). Here we have a folder “D:\Excel\29.ppt2pdf\ppt” with two PPT files (Image 2).

Image 1

Image 2

Step 4: Write below VBA code in your VBE module 

Sub ppt2pdf_Macro()
Dim oPPTApp As PowerPoint.Application
Dim oPPTFile As PowerPoint.Presentation
Dim onlyFileName As String, folderPath As String, pptFiles As String, removeFileExt As Long
      
Application.ScreenUpdating = False
  • Initialize variables
folderPath = Range("C5").Text & "\"
pptFiles = Dir(folderPath & "*.pp*")
  • Check and exit macro if no ppt files are in the folder
If pptFiles = "" Then
    MsgBox "No files found"
    Exit Sub
End If

Do While pptFiles <> ""
  • Assign PowerPoint application to variable
    Set oPPTApp = CreateObject("PowerPoint.Application")
    oPPTApp.Visible = msoTrue
      
    On Error Resume Next
  • Assign PowerPoint presentation to variable
    Set oPPTFile = oPPTApp.Presentations.Open(folderPath & pptFiles)
        
    On Error GoTo 0
  • Remove file extension and assign an only file name to a variable
    removeFileExt = InStr(1, oPPTFile.Name, ".") - 1
    onlyFileName = Left(oPPTFile.Name, removeFileExt)
    
    On Error Resume Next
  • Save ppt file to pdf file
    oPPTFile.ExportAsFixedFormat oPPTFile.Path & "\" & onlyFileName & ".pdf", ppFixedFormatTypePDF, ppFixedFormatIntentPrint
    oPPTFile.Close
  • Iterate to the next file in the folder
    pptFiles = Dir()
Loop
  • Close PPT Application and release memory
oPPTApp.Quit

Set oPPTFile = Nothing
Set oPPTApp = Nothing
    
Application.ScreenUpdating = True

MsgBox " Successfully converted"
End Sub

Step 5: To Run VBA Code:  

  • Press “Alt + F8” – to popup Macro dialog box.
  • Select Macro “ppt2pdf_Macro” and click “RUN”.

Step 6: Macro convert all PPT files from the folder to PDF and popup a below message

Output:



News
Improve
Discuss
Do you want to advertise with us?Click here to know more

VBA Subroutine in Excel - How to Call Sub in VBA?

article_img
When a specified action is performed on a worksheet with the help of a collection of code known as a VBA Subroutine. It also helps to read an external file, also it can open other applications from Excel. A large piece of code can be broken into small parts so that we can manage it easily. Let's learn why to use submarines: Converts large piece of codes into small parts so that the computer ignores all kind of complexities that arises because of large codesReusability of code suppose we in a program have to access the database frequently so instead of writing the code again and again we can create a function to access the databaseSubroutines are self-documenting functions which means a coder can easily say what the program does by looking into the name of the function Naming Rules of SubroutinesIt can start with a letter or an underscore but it cannot start with a number or a special character.It cannot contain any space in the name.The name of the subroutine cannot be a keyword like Private, Sub, End, etc. Syntax Private Sub function_name( ByVal arg1 As String, ByVal arg2 As String) End Sub Syntax Explanation Code Action "Private Sub function_name(...)"Private is the keyword whic
Read More

A

10 Best Tools to Convert PDF to Powerpoint

article_img
Maintaining the original layout intact in Microsoft PowerPoint presentations, the best tool to convert PDF to PowerPoint turns PDFs into PPT files. These devices simplify the converting process and are accessible via the internet, computers, and mobile devices. These converters, which have been verified for their user expertise, group conversions, platform accessibility, efficiency, and cost, facilitate workflow optimization and improve presentation software. Below are our Best Tools to Convert PDF to PowerPoint that you simply must have. This list has a lot of downloads for you to choose from, covering everything from efficiency to note-taking to creative projects and entertainment purposes. 10 Best Tools to Convert PDF to Powerpoint 10 Best Tools to Convert PDF to PowerPointAdobe AcrobatSmallpdfSoda PDFZamzarNitro ProPDFelementiLovePDFOnline2PDFConvertioPDF2GoConclusionFAQs - 10 Best Tools to Convert PDF to PowerPoint10 Best Tools to Convert PDF to PowerPointThe features, costs, and overall effectiveness of the top 10 Best Tools to Convert PDF to PowerPoint are enumerated here. Along with outlining the benefits and drawbacks of each choice, we'll also provide some advice on how t
Read More

A

Microsoft’s Latest 365 Copilot Updates: Enhanced AI Tools for Excel, PowerPoint, and Teams

article_img
Microsoft has rolled out new AI-powered features in its 365 suite of applications, significantly enhancing the capabilities of Excel, PowerPoint, and Teams. These updates are part of Microsoft’s ongoing efforts to make its productivity tools more intelligent, efficient, and user-friendly. The introduction of Copilot in these core applications brings automation, improved collaboration, and powerful data analysis features, aimed at transforming how users work and interact with Microsoft 365 tools.Let’s explore how these enhanced AI tools are set to boost productivity across Excel, PowerPoint, and Teams.Microsoft’s Latest 365 Copilot UpdatesEnhanced AI Features in Excel: Streamlining Data AnalysisExcel has long been a favorite tool for data management, and now, with Copilot's AI enhancements, the process of working with large datasets has become even easier. The new AI tools are designed to help users analyze, visualize, and interpret data more effectively.Key Features introduced in ExcelAI-Powered Data Insights: Copilot in Excel automatically generates key insights from your data, highlighting trends, patterns, and anomalies without the need for complex formulas.Natural Language Quer
Read More

VBA Multiple (Nested) If Statements in Excel

article_img
VBA in Excel stands for Visual Basic for Applications, which is Microsoft's programming language. To optimize the performance and reduce the time in Excel we need Macros and VBA is the tool used in the backend. What decision-making reasoning do you often use in your Excel worksheets? In most circumstances, you would test your condition using an IF formula and return one value if the condition is met and another value if it is not. You can nest multiple IFs inside of one another to assess more than one condition and return different values based on the outcomes. Where to Put the VBA Code in Excel?In the Microsoft Excel tabs, select the Developer Tab. Initially, the Developer Tab may not be available.  The Developer Tab can be enabled easily by a two-step process : Right-click on any of the existing tabs at the top of the Excel window.Now select Customize the Ribbon from the pop-down menu. In the Excel Options Box, check the box Developer to enable it and click on OK. Now, the Developer Tab is visible. Now click on the Visual Basic option in the Developer tab and make a new module to write the program using the Select Case statement.Developer  -> Visual Basic -> Tools -> Mac
Read More

How to Create an Input Box With Multiple Inputs in Excel Using VBA?

article_img
The Input Box is a dialogue box that helps users to take a value and do later computations according to the entered value. The input box is similar to the message box, but the message box is used to display the data while the input box is used to enter the data. By default, a message box displays only the Ok button in its conversation box, whereas an input box displays both the Ok and Cancel buttons. You can specify the type of data to be returned. In excel VBA Macro, Input Box is one of the most commonly used functions. In this example, we will learn how to create an input box using excel VBA which consumes multiple data from the end-user. For this, we will be creating a user form. Step By Step Implementation Step 1: Insert Visual Basic Editor To insert Visual Basic Editor in excel please refer to How to Insert and Run VBA Code in Excel? Step 2: Insert User Form In this step, we need to add a user form to our VBA. For this, we need to go to the Developer tab on the top of the ribbon and then select Visual Basic. Fig 1 - Open Visual Basic Once we click on the Visual Basic option, excel will open Visual Basic Editor in a new window. Fig 2 - Visual Basic Editor In the Visual Basic Ed
Read More

How to Convert VBA Collections to Array in Excel?

article_img
An object that can store a number of values whether it can be of string data type or integer which can be easily manipulated or iterated is called Collection. On the other hand, Array is also used to store the data but it is multidimensional but collections are single dimensions. Now, we will see how to convert the collection to an array for that we have to follow further steps: Converting Excel VBA Collection to Array Step 1: Press Alt + F11 to get the VBA box and select Insert and Module to write the code. Step 2: Define a sub-procedure in VBE. Step 3: Declare two variables one with the name "collection" as New Collection and another one with the name "arr" of size 3 type String. Step 4: Now, we will add items to the collection with the help of the "Add" keyword. Step 5: Adding items to the array from the collection using each loop. Step 6: Use MsgBox to print the elements in the array. Step 7: Press F5 to see the output.
Read More

How to Merge Multiple Excel Files into one Folder?

article_img
Power Query is a data manipulation tool frequently used for business intelligence and data analysis. Both Microsoft Excel and Microsoft Power BI support Power Query. A single source of truth and well-organized, error-free data are requirements for high-quality analysis. While many analysts spend many hours merging data, running lookups, and altering data, Power Query enables all of these tasks to be automated with straightforward steps. One of the most revolutionary tools available to any analyst dealing with data in Excel is Power Query. It will not only save up hours for analysts, but it will also lead to fewer manual errors and a better capacity to gather data from a single source of truth. Power Query, as its name suggests, is Excel 2010 and later a most potent data automation tool. Data may be imported into Excel using Power Query from various external sources, including Excel workbooks, CSV files, text files, and the web, to name a few. The information can then be cleansed and made ready for our needs. Power Query includes a number of helpful capabilities, including the ability to append data and establish connections across various data sources. The joining of the data sets
Read More

10 PowerPoint Presentation Tips to Make More Creative Slideshows

article_img
Creating a visual for what you want to explain to an audience needs the proper organization of thoughts. It becomes a piece of cake when you use a free PowerPoint template. The default templates are good to go but not enough to make a great impression. A brilliant presentation needs a customized template for the perfect visualization of concise information. In this article, we'll explore some of the top PowerPoint tips that will save you time and effort to create the best ppt.A poor choice of color or font style can bring down the quality of your presentation. In fact, a well-formatted image can distract the audience. All you need is to understand the tonality of your presentation topic along with the audience you want to address.Here is a list of 10 ‘powerful’ PowerPoint tips straight from the desks of experts to make your point.10 Expert PowerPoint TipsYou can easily design a presentation with a default PowerPoint template. Will it stand out from the crowd? To make an impact, check these tips and include them in your presentation idea.1. Stop using default PowerPoint featuresMicrosoft has done a commendable job by creating PowerPoint for years now. The more advanced the version i
Read More

S

Insert WordArt in Microsoft Powerpoint

article_img
WordArt in PowerPoint is a great way to add stylish, decorative text to your slides. Whether you want to create eye-catching titles, emphasize key points, or enhance your slide design, WordArt offers a variety of customization options.In this guide, you’ll learn how to insert, format, and customize WordArt in PowerPoint to make your presentations more engaging and visually appealing.How to Insert WordArt in PowerPoint What Is WordArt in PowerPoint?WordArt is a special text formatting feature in PowerPoint that allows users to create decorative text with different styles, colors, effects, and shapes. It helps make titles, headings, and key points stand out in presentations.WordArt can be used for:Creating stylish text effects for headingsHighlighting important content on slidesAdding 3D effects and artistic designs to textEnhancing slide aesthetics without using additional imagesHow to Insert WordArt in PowerPoint Adding WordArt in PowerPoint is simple and can be done in just a few steps.Step 1: Open PowerPoint and Select a SlideLaunch Microsoft PowerPoint and open the slide where you want to insert WordArt.Open PowerPoint and Select a Slide Step 2: Go to the Insert TabClick on the
Read More

Top PowerPoint Shortcut Keys List

PowerPoint is like your best friend when it comes to sharing ideas, presenting projects, and keeping your audience engaged. But did you know there's something super cool hidden in there? It's called keyboard shortcuts. Think of them as your magic wand—they help you move smoothly between slides, make your designs look perfect, and make creating presentations a breeze, just like a conductor leads an orchestra. What is PowerPoint Keyboard Shortcut PowerPoint keyboard shortcuts are like cheat codes for making your PowerPoint experience faster and smoother. Instead of clicking around with your mouse, you can press certain keys on your keyboard to do things like copying, pasting, formatting text, or moving between slides. They're like shortcuts that help you get things done quicker and easier, making you a PowerPoint pro in no time! We have also compiled all the essential computer shortcut keys, which include shortcuts for popular software like Microsoft Word, Excel, PowerPoint, and Gmail, as well as special characters and shortcuts relevant to competitive exams. Basic Shortcuts in PowerPoint Keyboard Shortcuts Action Ctrl + N Create a new presentation. Ctrl + T Open the Font dialog box.
Read More
three90RightbarBannerImg