Software Solutions Online

VBA and VB.Net Tutorials, Education and Programming Services

Copy slides from one presentation to another (vba for powerpoint).

In this article I will explain how you can copy slides from one PowerPoint presentation to another using VBA.

Before Running the Code

Preserve Formatting When Copying Slides

Slides to be copied

Asides from copying the slide the code above copies the design. If you wanted to do this manually you would copy the slidemaster over to the new presentation. You can’t copy the slidemaster using VBA but instead you can set the design property of the slides.

Download Sample Files.

3 thoughts on “Copy Slides From One Presentation to Another (VBA for PowerPoint)”

Leave a reply cancel reply.

Your email address will not be published. Required fields are marked *

  • Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers
  • Advertising & Talent Reach devs & technologists worldwide about your product, service or employer brand
  • OverflowAI GenAI features for Teams
  • OverflowAPI Train & fine-tune LLMs
  • Labs The future of collective knowledge sharing
  • About the company Visit the blog

Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Get early access and see previews of new features.

Copy one slide to multiple presentation

I have task to copy one slide to multiple ppt presentations. All ppts are in same folder. I don't have an idea how to start. So far I have change some simple stuff with VBA as changing font, title etc. Anybody can help me? Thanks in advance

  • powerpoint-2010

Norbert Kulacin's user avatar

2 Answers 2

Use the InsertSlideFromFile method which takes this form:

Example. To copy slides 3 to 4 from test.pptx and paste them to the end of your currently open presentation (the ActivePresentation):

If all files are on the same path as the open presentation, you can automate the path by starting with this:

More info on the InsertSlideFromFile method here:

https://msdn.microsoft.com/en-us/library/office/ff746047.aspx?f=255&MSPPError=-2147217396

Jamie Garroch - MVP's user avatar

I found this VBA code that may help you get started. This will copy all of the slides from the first presentation to a second presentation using a loop. You can modify the code to copy a single slide and then past into multiple presentations with the loop.

For example, if you open the target PPTX presentation and run the following VBA macro, it will copy the first slide out of the 2.pptx presentation file and paste it into the current target PPTX.

JeroByte's user avatar

Your Answer

Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more

Sign up or log in

Post as a guest.

Required, but never shown

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy .

Not the answer you're looking for? Browse other questions tagged vba powerpoint powerpoint-2010 or ask your own question .

  • The Overflow Blog
  • Unpacking the 2024 Developer Survey results
  • Featured on Meta
  • We've made changes to our Terms of Service & Privacy Policy - July 2024
  • Introducing an accessibility dashboard and some upcoming changes to display...
  • Tag hover experiment wrap-up and next steps

Hot Network Questions

  • Can I use specific preprocess hooks for a node type or a view mode?
  • Arduino Board Getting Too Hot: Need Help Diagnosing Issue (Schematic Provided)
  • Refereeing papers by people you are very close to
  • Make a GCSE student's error work
  • Is there a pre-defined compiler macro for legacy Microsoft C 5.10 to get the compiler's name and version number?
  • commands execution based on file size fails with no apparent issues
  • Is Marisa Tomei in the film the Toxic Avenger?
  • Approximating a partition
  • Netgate 6100 Will Not Acknowledge Lastest Versions of pfSense (When Checking For Updates)
  • TV movie, amputations to build a super athlete
  • Washing machine drain
  • What equipment would be needed for a top of the line hacking group?
  • Safe(r) / Easier Pointer Allocation Interface in C (ISO C11)
  • Will lights plugged into cigarette lighter drain the battery to the point that the truck won't start?u
  • What type of concept is "mad scientist"?
  • High-precision solution for the area of a region
  • "Seagulls are gulling away."
  • Double accentuation (Homeric Greek)
  • Is there a reason SpaceX does not spiral weld Starship rocket bodies?
  • Is there mutable aliasing in this list of variable references?
  • Can a train/elevator be feasible for scaling huge mountains (modern technology)?
  • Litz Limitations
  • How can I append comma except lastline?
  • What are these red pointy flower buds with heart-shaped leaves?

powerpoint macro copy slide another presentation

MrExcel Message Board

  • Search forums
  • Board Rules

Follow along with the video below to see how to install our site as a web app on your home screen.

Note: This feature may not be available in some browsers.

  • If you would like to post, please check out the MrExcel Message Board FAQ and register here . If you forgot your password, you can reset your password .
  • Question Forums
  • Excel Questions

Copy slides from one Powerpoint presentation to another

  • Thread starter Nick70
  • Start date Jun 3, 2016

Active Member

  • Jun 3, 2016

Excel Facts

Worf

Well-known Member

  • Jun 4, 2016

Hi Code: ' PowerPoint macro Sub Example2() Dim objPres As Presentation, i%, src, tgt, source As Presentation Set source = ActivePresentation src = Array(2, 3) ' source position tgt = Array(4, 5) ' target position Set objPres = Presentations.Open("C:\pub\title.pptx") ' target file For i = LBound(src) To UBound(src) source.Slides(src(i)).Copy objPres.Slides.Paste tgt(i) objPres.Slides(tgt(i)).Design = source.Slides(src(i)).Design Next 'objPres.Close End Sub  

  • Jun 6, 2016
  • Jun 7, 2016

Similar threads

  • Jul 5, 2024
  • Sep 5, 2023
  • Oct 12, 2023

SeniorNewbie

  • Oct 2, 2023
  • Jan 4, 2023

Forum statistics

Share this page.

powerpoint macro copy slide another presentation

We've detected that you are using an adblocker.

Which adblocker are you using.

AdBlock

Disable AdBlock

powerpoint macro copy slide another presentation

Disable AdBlock Plus

powerpoint macro copy slide another presentation

Disable uBlock Origin

powerpoint macro copy slide another presentation

Disable uBlock

powerpoint macro copy slide another presentation

AutomateExcel Logo

AutoMacro: Ultimate VBA Add-in

VBA Code Helper

Read all reviews

Return to VBA Code Examples

PowerPoint VBA Macro Examples & Tutorial

powerpoint macro copy slide another presentation

Editorial Team

powerpoint macro copy slide another presentation

Reviewed by

Steve Rynearson

In this Article

VBA PDF (Free Downloads)

Save as macro-enabled presentation, enable ‘developer’ tab in the ribbon, create powerpoint macro, powerpoint application, open a new presentation, open an existing presentation, open and assign to a variable, refer to active presentation, save current presentation, close current presentation, useful references, assign existing presentation (by name) to variable, assign active slide to variable, assign slide by index to variable, count number of slides, get slide index number of current slide, add a blank slide to end of slide show, add a slide after current slide, delete a slide, go to a specific slide, loop through all slides, loop through all shapes of active slide, loop through all shapes in all slides, loop through all textboxes of active slide, loop through all textboxes in all slides, copy selected slides to new ppt presentation, copy active slide to end of active presentation, change slide during slide show, change font on all slides in all textboxes, change case from upper to normal in all textboxes, toggle case between upper and normal in all textboxes, remove underline from descenders, remove animations from all slides, save presentation as pdf, find and replace text, export slide as image, resize image to cover full slide, exit all running slide shows, open powerpoint – early binding, open powerpoint – late binding, make application visible, maniplulate powerpoint, close the application, copy from excel to powerpoint, powerpoint vba faqs.

This is a complete guide to automating PowerPoint using VBA (Visual Basic for Applications) Macros.  Below you will find many useful examples.

Download our free Microsoft PowerPoint VBA Tutorial! Or VBA Tutorials for other Office Programs!

vba powerpoint tutorial pdf

PowerPoint VBA (Macros) Tutorial

The Presentation with VBA code should be ‘Saved As’ PowerPoint Macro-Enabled Presentation (*.pptm)

vba powerpoint macro enabled

You should to enable the Developer tab on the Ribbon before creating VBA code. To do so choose File -> Options then click on ‘Customize Ribbon’ and check the box next to ‘Developer’ tab in the right pane.

powerpoint vba developer ribbon

This is a simple example of a PowerPoint VBA Macro:

It saves the active presentation as a PDF. Each line of code does the following:

  • Creates variables for the PowerPoint name and PDF name
  • Assigns the active presentation name to pptName variable
  • Creates the full PDF name
  • Saves the presentation as a PDF

When VBA code is running within a PowerPoint Presentation, PowerPoint Application is the default application and it can be manipulated without explicitly reference. Create a New Presentation

To create a presentation, use the Add method of PowerPoint application.

To open a new and blank presentation use the Add method of Application.Presentations collection

To open a presentation which you have already created, use the Open method of Application.Presentations collection

The code above assumes that the presentation is in the same directory as the PowerPoint Presentation containing the code.

You should assign the presentation you open to a variable so that you can manipulate it as per your requirements.

Use the reference ActivePresentation to manipulate the Presentation active in the GUI when the VBA code is executed.

The statement below will save the Active Presentation if it was saved before. It it has not been saved then you will be prompted with the ‘Save As’ dialog.

The statement below will close the Active Presentation even if it was not saved after the last edit.

You can move a slide from its old position to the new position

You can do something with each slide or go through all slides to find a few slides and do something about with using the code;

The power of PowerPoint can be realized by using ‘Shapes.’ The code below loops through all the shapes on the current slide so that you can manipulate them as you want;

You can loop through all the shapes in the presentation by adding a loop to go through all slides.

TextBoxes are the most often used Shape in PowerPoint presentations. You can loop through all the Text Boxes by adding a check for ‘Shape Type.’ TexBoxes have the shape type defined as the VBA constant msoTextBox (the numerical value of the constant is 17)

Again, you can loop through all the textboxes in the presentation by adding a loop to go through all slides.

To copy certain slides to a new presentations, first select the desired slides in the existing presentation and then run the code below;

Useful PowerPoint Macro Examples

Here are some useful macro examples showing how to do tasks. These will also demonstrate the concepts described above.

In typography, a descender is the portion of a letter that extends below the baseline of a font. In most fonts, descenders are reserved for lowercase characters such as g, j, q, p, y, and sometimes f.

When you underline text, it does not look nice under descenders. Here is the code to remove underline from all such characters g, j, p, q, and y in the whole Presentation.

Use the code below to remove all animations set in a Presentation.

You can easily save Active Presentation in PDF format.

You can find and replace text in All TextBoxes of All Slides. After the fist instance of the text you want to find (defined by findWhat) you need to loop through the Find command to find other instances, if any.

You can export Current SLide (or any other slide) as a PNG or JPG (JPEG) or BMP image.

If you have multiple Slide Shows open at the same time then you can close all of them using the macro below.

Automating PowerPoint from Excel

You can also connect to PowerPoint though other applications (like Excel and Word). As as first step, you must refer to an instance of PowerPoint.

There are two ways of doing it – early binding and late binding .

In ‘Early Binding’ you must explicitly set a reference to ‘Microsoft PowerPoint 16 Object Library’ (for MS Office 2019) in the VBE (Visual Basic Editor) using the option Tools->References.

In ‘Late Binding’ application variable is declared as an object and VBA engine connects to the correct application at run time.

After setting the reference to PowperPoint application, you may need to make it visible.

You can use all the methods to manipulate presentations, from within PowerPoint, described above from Excel by just adding the reference to PowerPoint created by you above.

For example

has to be used liked this

Once you have completed what you wanted to do with the PowerPoint application you must close it and should release the reference.

This code will copy a range from Excel to PowerPoint:

Note : It has been kept as simple as possible to show how a range from Excel can be copied to PowerPoint using VBA.

What are macros in PPT?

A Macro is a general term that refers to a set of programming instructions that automates tasks. PowerPoint (PPT) Macros automate tasks in PowerPoint using the VBA programming language.

How do I use VBA in PowerPoint?

To use VBA in PowerPoint, open the VBA Editor (ALT + F11 or Developer > Visual Basic).

How do I create a Macro in PowerPoint?

1. Open the VBA Editor (ALT + F11 or Developer > Visual Basic) 2. Go to Insert > Module to create a Code Module 3. Type ‘Sub HelloWorld’ and press Enter 4. In between the lines ‘Sub HelloWorld’ and ‘End Sub’, type ‘MsgBox “Hello World!’ 5. You’ve created a Macro! 6. Now press ‘F5’ to run the Macro

Written by: Vinamra Chandra

vba-free-addin

VBA Code Examples Add-in

Easily access all of the code examples found on our site.

Simply navigate to the menu, click, and the code will be inserted directly into your module. .xlam add-in.

(No installation required!)

Free Download

automacro

AutoMacro: VBA Add-in with Hundreds of Ready-To-Use VBA Code Examples & much more!

Get the Reddit app

A place for questions and discussion on Visual Basic for Applications (VBA) and its integrated development environment (IDE).

[POWERPOINT]Copy Slide to another Presentation

Hello! I wanna copy a few slides from one Presentation to another Presentation but I can't get my code to work and I don't know where to start, since I'm new to VBA. I've tried numerous ways to debug it, but none of them worked.

The code runs but nothing happens. Would appreciate some help, here's the code. Thank you in advance :)

By continuing, you agree to our User Agreement and acknowledge that you understand the Privacy Policy .

Enter the 6-digit code from your authenticator app

You’ve set up two-factor authentication for this account.

Enter a 6-digit backup code

Create your username and password.

Reddit is anonymous, so your username is what you’ll go by here. Choose wisely—because once you get a name, you can’t change it.

Reset your password

Enter your email address or username and we’ll send you a link to reset your password

Check your inbox

An email with a link to reset your password was sent to the email address associated with your account

Choose a Reddit account to continue

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Slide.Duplicate method (PowerPoint)

  • 7 contributors

Creates a duplicate of the specified Slide object, adds the new slide to the Slides collection immediately after the slide specified originally, and then returns a Slide object that represents the duplicate slide.

expression . Duplicate

expression A variable that represents a Slide object.

Return value

This example creates a duplicate of slide one in the active presentation and then sets the background shading and the title text of the new slide. The new slide will be slide two in the presentation.

Slide Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.

Was this page helpful?

Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see: https://aka.ms/ContentUserFeedback .

Submit and view feedback for

Additional resources

IMAGES

  1. Microsoft powerpoint copy template to another presentation

    powerpoint macro copy slide another presentation

  2. How to Copy Slides from One Presentation to Another in PowerPoint

    powerpoint macro copy slide another presentation

  3. Copy PowerPoint Slides to Another Presentation

    powerpoint macro copy slide another presentation

  4. How-to Guide: Copy Slides From One PowerPoint to Another

    powerpoint macro copy slide another presentation

  5. How-to Guide: Copy Slides From One PowerPoint to Another

    powerpoint macro copy slide another presentation

  6. How to Copy Slides to Another Presentation

    powerpoint macro copy slide another presentation

COMMENTS

  1. Copy Slides From One Presentation to Another (VBA for PowerPoint)

    In this article I will explain how you can copy slides from one PowerPoint presentation to another using VBA. Example 1

  2. vba - Copy one slide to multiple presentation - Stack Overflow

    You can modify the code to copy a single slide and then past into multiple presentations with the loop. For example, if you open the target PPTX presentation and run the following VBA macro, it will copy the first slide out of the 2.pptx presentation file and paste it into the current target PPTX.

  3. Copy slide from one presentation into another VBA - MrExcel

    I need the macro to copy from the first opened powerpoint and then copy and paste into the second. This will occur on a loop connected to another macro, so I need the slide to be pasted underneath any pre-existing slides in the new presentation.

  4. Slide.Copy method (PowerPoint) | Microsoft Learn

    This example copies slide one in the active presentation to the Clipboard. ActivePresentation.Slides(1).Copy See also. Slide Object. Work with Partial Documents. Support and feedback. Have questions or feedback about Office VBA or this documentation?

  5. VBA: PowerPoint - Copy slides from one presentation to another

    What I would like to do is take slides from an existing presentation and paste those into a new presentation. I want to keep the same format of the presentation the slides are sourced from. Note, the two presentations have the same format/template so I'm assuming this shouldn't be an issue.

  6. Copy slides from one Powerpoint presentation to another - MrExcel

    Every week I need to take some slides from a presentation and add them to another presentation. I found a code which copies (all) slides from one presentation and pastes them (all) to the other one, see below: Code: Sub Example2() Dim objPresentation As Presentation. Dim i As Integer.

  7. Slides.Paste method (PowerPoint) | Microsoft Learn

    Pastes the slides on the Clipboard into the Slides collection for the presentation. Specify where you want to insert the slides with the Index argument. Returns a SlideRange object that represents the pasted objects.

  8. PowerPoint VBA Macro Examples & Tutorial - Automate Excel

    Copy Selected slides to new PPT Presentation. To copy certain slides to a new presentations, first select the desired slides in the existing presentation and then run the code below;

  9. POWERPOINT]Copy Slide to another Presentation : r/vba - Reddit">[POWERPOINT]Copy Slide to another Presentation : r/vba - Reddit

    I wanna copy a few slides from one Presentation to another Presentation but I can't get my code to work and I don't know where to start, since I'm new to VBA. I've tried numerous ways to debug it, but none of them worked.

  10. Slide.Duplicate method (PowerPoint) | Microsoft Learn">Slide.Duplicate method (PowerPoint) | Microsoft Learn

    This example creates a duplicate of slide one in the active presentation and then sets the background shading and the title text of the new slide. The new slide will be slide two in the presentation.