EasyTweaks.com

How to create and add slides to PowerPoint presentations with VBA?

A couple days ago, a reader asked about there is a way to automate creation of PowerPoint presentations from scratch and then quickly add slides to that existing presentation. I though that script might be highly in the list of the most useful PowerPoint Macros. 

As we indicated in the past, PowerPoint doesn’t include a Macro Recorder (that’s unlike Excel and Word, which both have built in recorders for Macro). Therefore, we are left with good old Visual Basic for Application that we can use to create simple Macros to automate PowerPoint. There are further alternatives for PowerPoint Automation, but those goes beyond the scope of this tutorial.

In today’s short tutorial, we’ll go over three different use cases:

  • New presentation creation (blank or using a template)
  • Add slides to an existing presentation.
  • A mix of the two above mentioned cases (Create from scratch and slides addition)

Let’s get started.

Look at the Ribbon. If you don’t see the a Developer entry in the menu, before start your coding you’ll need to enable the developer tab.

After you make the Developer menu visible your Ribbon, go ahead and hit on Developer , then hit on the Visual Basic button (or simply go ahead and hit Alt+F11) to open the Visual Basic IDE.

VBA to Create PowerPoint Presentation

  • In the VB Editor, right click on VBAProject and hit Insert .
  • Select Module .
  • Paste the following code in the newly create module.
  • Hit File and then Save.
  • To Run your code, hit Run and then pick Run Sub/User Form (or simply F5).
  • Close the VB editor.

VBA to insert slides

  • In the VB Editor, right click on VBAProject and hit Insert.
  • Select Module

Add slides at the end of the presentation

In order to insert a new blank slide at the last position in your presentation, use the following VBA code:

Macro to setup a new presentation and add slides

That would be just mixing up the two snippets outlined above.

Generate a PowerPoint Presentation from Excel

Last case is that you would like to create a PowerPoint presentation right from an Excel spreadsheet. You can employ the same technique from Word and other Microsoft 365 Applications.

  • Link the Spreadsheet to the PowerPoint Data Model (from Tools>>References)
  • Insert a button unto your Excel spreadsheet (Developer >> Insert and then pick a Command Button).
  • Insert the VBA code below into your Spreadsheet VBA Project (directly into the Sheet or into a VBA Module)
  • Modify the script as required.
  • Run (hit F5) and test the outcome.

How to use VBA in PowerPoint: A beginner’s guide

  • Written by: Jamie Garroch
  • Categories: PowerPoint productivity , Presentation technology
  • Comments: 45

powerpoint vba presentations add

Here at BrightCarbon we’re always looking for new ways to improve our own PowerPoint productivity and then share that knowledge with the presentation community (that includes you, by the way!). One of the ways we do this is by using VBA code to automate and extend the functionality of PowerPoint. We publish  free PowerPoint VBA code snippets here in our blog for you to use and also offer a PowerPoint automation service . This article explains how to grab the code from our articles and use it in your PowerPoint project, so that you can take your productivity to the next level!

What is VBA?

Visual Basic for Applications (VBA) is a programming environment for Microsoft Office applications. It’s included with your installation of Office by default  ( unless your system administrator has deactivated it ) . PowerPoint VBA provides you with a way to do one of two things   using macros and add-ins:  

  • A utomate  PowerPo int:   If you ever find yourself repeating the same task over and over again, VBA could be your new best friend.  Let’s say you have 100 slides and you need to unhide all hidden objects  across all those slides . That could take you  many  eye-straining minutes, but with a PowerPoint VBA it takes around a  second.
  • E xtend  PowerPoint :   Sometimes PowerPoint doesn’t have the feature you need  to complete your task . As an example, if you end up deleting default layouts from a template, there’s no  easy  way in PowerPoint to get them back. This article includes PowerPoint VBA code to do just that!

How to open the VBE (Visual Basic Editor)

Getting to meet your VBA friend is very simple. With PowerPoint open and at least one presentation file open, press  Alt+F11 * on your keyboard. This will open the VBE (Visual Basic Editor):  

PowerPoint VBE No Modules

*If for some reason Alt+F11 isn’t mapped on your keyboard you can right click anywhere on the ribbon, select  Customize the Ribbon…  and in the window that appears, tick the  Developer Tab  check box over on the right hand side before clicking  OK  to close the window. Now you can click the  Visual Basic  button within this tab:  

PowerPoint Developer Tab Visual Basic

Adding PowerPoint VBA code  

To add some VBA code, you need a container to put it in so go ahead and click  Insert  from the menu and then select  Module :  

PowerPoint VBE Insert Module

You now have a module ready to paste the VBA code into  from one of our blog articles :  

PowerPoint VBE Module Inserted

Copy the VBA code from  the required blog article  by double-clicking on it and then paste it into the  Module1  window above.  Here’s a very simple example of some code  to display a message dialogue :

You should now see something like this:  

PowerPoint VBA

Because this code is just a single  Sub  procedure called  HelloWorld , it’s referred to as a macro.  

Running  the PowerPoint VBA macro  

Now you have the macro in your presentation you can use  Alt+Tab  to return to the more familiar PowerPoint window. From here, the macro can be run by pressing  Alt+F8  on your keyboard  (or b y  clicking the  Macros  button in the Developer tab)  which opens a window containing a list of available macros:  

PowerPoint VBA

Security Soup

The first time you add VBA code to a file, Microsoft assumes that it is safe because you added it. As soon as you save, close and reopen the file, Microsoft doesn’t know that it’s your code so it will disable it by default. You can tell the Office app to allow your code to run either by signing it with a digital certificate (beyond the scope of this article) or by lowering the security setting for the app. You can do this in PowerPoint by clicking File / Options / Trust Center / Trust Center Settings / Macro Settings and selecting this option shown below:

VBA Macro Settings

Saving your file  

powerpoint vba presentations add

Once you ’ve added  VBA code  to  your presentation, PowerPoint will  ask you to save it as a  pptm  file  (the ‘m’ stands for macro)  instead of the more  familiar  pptx  format .  You can go ahead and do this to  either  keep a n archive  copy of your  code-enabled  project  or   to  create your personal macro library.  

If you want to distribute your  presentation,   it’s advisable to   save  it  using the familiar pptx format so that  your  recipients don’t see lots of verbose  security  messages  when opening  pptm  files!  

Y ou can  make  your file saveable as a standard presentation again  by  right – click ing  on  each   code module in the  project explorer pane , clicking  Remove   ModuleX …   and either click  Yes   (if you want to keep a backup of the modules independently of your presentation)  or  No   when  asked if you want to save the module before removing it :  

powerpoint vba presentations add

Now your presentation doesn’t include any code and you can save it as a pptx file.  

So, there you have it.  You now know how to open the VBE, insert a PowerPoint VBA code module, paste code into it, run the macro and save the file in either pptm  or pptx formats. All you need is a cool macro to make your daily life even easier. Keep checking in with our blog for more useful macros – like this one on restoring default slide master layouts!

Got something extra you’d like PowerPoint to do?

Check out our PowerPoint automation service which provides you with a custom solution to your specific needs.

powerpoint vba presentations add

Jamie Garroch

Principal technical consultant, related articles, how to consistently brand graphs and charts across microsoft office.

  • PowerPoint design / PowerPoint productivity
  • Comments: 1

How do you make sure that your graphs and charts have consistent branding across Excel, PowerPoint and Word? Learn how to create and use custom templates that support your brand identity across Microsoft Office.

powerpoint vba presentations add

Changes to VBA Macro Security in Microsoft 365

  • Presentation technology / Industry insights
  • Comments: 2

You can do some really cool things in Microsoft Office with just a few lines of Visual Basic for Applications (VBA) - from creating your own custom formula in Excel to correcting branded content in PowerPoint to merging address data for a mail campaign in Word. And sometimes you need to share that VBA solution with colleagues and clients, via the Internet. A change that Microsoft rolled out at the end of March 2022 tweaks the process required by Windows users to gain access to this active content.

powerpoint vba presentations add

Protecting your prized PowerPoint content

  • PowerPoint productivity / Presentation technology

Our comprehensive guide to password protecting PowerPoint files so your precious presentations stay just they you made them!

very simple, very explicit, very good help for a beginner vba programmer in powerpoint. Thanks

great resource, thanks. I’ve used VBA for years in MSaccess, and this is a good refresher for me.

I am trying to make a ppt file that loops until stopped. then I save it as a video. the ppt ran and looped continuously. Once recorded as video it stopped looping. do you have code to make ppt work when in video format

Hi Charles. As soon as you export a PowerPoint deck as a video all the PowerPoint functionality is removed as the file is magically transformed into an MP4 file, without VBA (sob sob). The only way to make the video loop is to use the looping feature of your video player.

Yeah, your best off recording a screen capture of the presentation running, then cutting it so it loops perfectly.

You can convert the video into gif file so that it will loop

Hi Jamie, thanks for the clear into, I am very new to this so that really helps. I am trying to develop a VBA macro that looks for the left hand mouse key being pressed and held down for more than two seconds whilst over a shape in slideshow mode. Once this is satisfied (i.e. two second press) for it then to hyperlink or take the user to a specified slide or even the next slide worst case.

I realise there is an automated/ built in feature (Action) that does this type of thing for a mouse click or mouse over but I really need a “long press” to activate if possible.

Any help appreciated.

Hi Simon and thanks for a great question. What you’re looking to do is pretty complex because VBA doesn’t natively support mouse actions in the PowerPoint slide show window. But, it is possible to use a Windows API (hence no Mac compatibility) called GetAsyncKeyState to gain access to mouse button click events. I had a look at this and quickly ran into a brick wall because an action link to a macro in slide show mode (Insert / Action / Mouse Click / Run macro) fires on the mouse up event, not mouse down. That means any corresponding VBA timer code can’t run until after the user releases the button and hence too late to detect if it was held down for two seconds. Maybe something could be done with the mouse over event to simulate what you need to achieve? Another approach could be to use the mouse down event on an invisible userform although that is also getting very involved with multiple Windows APIs. Depending on what you’re trying to do, you could also start the timer on click one, change the colour of the clicked shape and show countdown text before reverting to the original colour. If the user clicks a second time before the time expires, then the hyperlink is fired.

Valuable app

Hello I have a question:

Private Sub CommandButton2_Click() ActivePresentation.FollowHyperlink _ Address:=”http://192.168.16.49/?OUT1=ON”, _ NewWindow:=False, AddHistory:=False ActivePresentation.SlideShowWindow.View.GotoSlide (2)

Now it opens Chrome. but how can i make it that it opens te address en afther that shut down chrome.

Hi Tom. Your example should open the default browser at the URL specified by the Address parameter. For more information on the FollowHyperlink method, see this Microsoft documentation: https://docs.microsoft.com/en-us/office/vba/api/powerpoint.presentation.followhyperlink

Thank you very much! It’s exactly what I needed.

I have tried using your randomizing macro with a powerpoint – I must be doing something wrong, because it isn’t putting the slides in random order. Please advise! I copied the macro exactly (using cut & paste), and thought I was following all the directions here for how to use it in the powerpoint. But, no random presentation of the slides. Boo hoo!

Hi Marya. Let’s check that VBA is installed and enabled on your machine. Can you add the following macro to the VBE project (just below the existing one) and try to run it from the PowerPoint window using Alt+F8?

Sub CheckVBA() MsgBox “it’s working” End Sub

Make sure the quotes are the straight type.

I am trying to format my title page so that the number displayed is equal to the linked slide and updates automatically wherever the slide is moved. For example “about us” is on slide #5 and linked, so it goes to slide 5 when you click on the word. I need the number (in a separate text box) to update automatically to the slide number location that the link goes to.

Hi Mary and thanks for the question. It looks like you’re interested in some kind of automated agenda slide builder. That’s a fair bit of code to create and quite complex as it needs to handle events from PowerPoint to detect when slides have moved. It could be possible to write a simpler macro which you run manually each time you want to update that title page. You’d need start by finding a way to identify which objects are your numerical indicators. For example, if you named your objects in the selection pane (Alt+F10) “Agenda Link”, then is simple macro could be a starting place for you: Sub UpdateAgendaNumbers() Dim oSld As Slide Dim oShp As Shape Dim LinkedSlideIndex As Long On Error Resume Next For Each oSld In ActivePresentation.Slides For Each oShp In oSld.Shapes If oShp.Name = “Agenda Link” Then If oShp.ActionSettings(ppMouseClick).Action = ppActionHyperlink Then If oShp.HasTextFrame Then LinkedSlideIndex = Split(oShp.ActionSettings(ppMouseClick).Hyperlink.SubAddress, “,”)(1) oShp.TextFrame.TextRange.Text = LinkedSlideIndex End If End If End If Next Next End Sub

Great wealth of information. Have never used macros before but was looking to use them to help with this situation. At work we use Work Orders (created in Power Point) and are looking to include a sequential number to them (print 50-100 copies of one slide with the numbers) and if possible would like the number to continue from the last printed number…been trying to find some code to help but not having much luck possible partly due to being new to macros

That’s definitely something we could help design for you Joshua. If you’d like to discuss further, please click the Contact button at the top of this page.

I tried this changing the font color of text within the textbox. I used this to change the font color on a mouse over:

Public Sub GraphicHover(ByRef oGraphic As Shape)

oGraphic.TextFrame.TextRange.Font.Color.RGB = RGB(0, 130, 202)

and it works just fine. But, when I move the mouse off the text box, onto the invisible rectangle with this code attached to the mouseover event, it doesn’t change the text color back to it’s original color and remains the color I changed it to mentioned above. I know the mouseover event is being triggered because I checked “Highlight when mouse over” and I am seeing the highlight on the invisible rectangle:

Public Sub ResetGraphicHover(ByRef oCover As Shape) Dim oSld As Slide Dim oShp As Shape Set oSld = oCover.Parent For Each oShp In oSld.Shapes With oShp.TextFrame.TextRange.Font.Color If .RGB = RGB(0, 130, 202) Then .RGB = RGB(121, 135, 156) End With Next End Sub

Any clue where my ResetGraphicHover is failing?

Hi Dave. I took your code and it works for me. You could add a debug line after the For Each… line in the rest macro to check that (a) it’s firing and (b) which shapes are being looked at on your slide. To do that, add this:

Debug.Print oShp.Name

After you run the slide show, check the output in the VBE Immediate pane (Ctrl+G to toggle it).

Hi I am creating an interactive game (matching cards or concentration) in PowerPoint. If the 2 cards match, I need a pop-up text box to appear. If the 2 cards do not match, I need a sound to play.

I understand I need programming to make this happen. Please help or give alternative ways to achieve this. Thanks.

Hi Tammy. Have a look at this article which will help you: https://www.brightcarbon.com/blog/powerpoint-memory-game/

Hi Producer I will like to get comments on macros you can make available to me. Beautiful. I am using this approach frequently to make offline projects. Thanks. S. Fas

Excellent!!! Thank you!

You’re more than welcome Nataša!

Thank you! Is there any option to replace a font in the entire presentation for a specific character. Let’s say, I would like to change font only for dots in the deck but I would like to keep the rest in the original font. Any idea please? Thank you so much!

Hi Jan. You might be able to use the Replace Fonts feature found in the Home tab of PowerPoint under the Replace menu at the far end of the ribbon. If you need to use VBA then set up a nested loop to iterate all shapes within all slides and then use the oShp.TextFrame2.TextRange.Font object to change the font.

Exellent explenation. so beutiful. I am creating an interactive e learing quiz. Thanking you.

Hello! I have a client who’s interested in using tagging to help create searchable content within slides. For example, they have four different categories for slide content across multiple presentations (Overview, Market, Product, Country). I’d like to assign a different shape to represent each of the four categories, where a blue square might represent Overview slide content. Then, when someone uses the keyword “Overview” to search for overview content (on Teams or SharePoint), these slides are easily identified. Is this something that’s possible with VBA code?

Hi Linda. That’s a very good question! Given the need is to search via SharePoint, VBA probably won’t help here as the PowerPoint file needs to be opened for VBA to examine its content. I have a sneaking suspicion that if you add keywords in the Tags field under File / Info that SharePoint may use this. But, that’s at the file level rather than the slide level. We have a PowerPoint add-in called ShowMaker that might be of interest as it allows you to add category metadata to slides and then the presenter can use that to filter the deck and export the required content. You can find an overview of it here: https://www.brightcarbon.com/showmaker/ and we could set up a demo if you’re interested (please use the Contact button at the top of this page if that’s the case).

I’ve just created an elearning package in PowerPoint using VBA , I didn’t realise it could sum up text boxes within PowerPoint to mark the qualification at the end. Also used AWS text to speech over the top of the learning . Looks great

Sounds like a fun and successful project Stu! Thanks for sharing 🙂

I have a bit of a tricky one but hoping it is possible to do with VBA. We offer training services to multiple clients that can be customized but the majority of training is consistent from one client to the next (main changes are the slide masters/formatting and addition/removal of certain sections).

What we want to do is create one master (or multiple) training document(s), and then use VBA’s to link it to the client specific PowerPoint. We want to link the master rather than using the “reuse slide” command so that if we update one file the other will automatically update as well.

Not sure if it matters, but our company uses sharepoint as storage

Hi Dave and thanks for a great question. VBA is an excellent solution for automating a manual process. In general, if a person can perform a task manually via a sequence of pre-defined steps then VBA can do it automatically, faster, and with less chance of mistakes for something done many times. We’d be happy set up a call to discuss your needs further and see what could be automated with VBA. If that’s of interest, please use the contact button at the top of the page and mention my name in the form.

PP does not seem to have the record macro feature. To write vba code in PP by someone who only worked with vba in excel, would require some prior knowledge. Is there a summary of the most common objects, methods etc to refer to?

Hi Reef. You’re correct that there’s no VBA macro recording feature in newer versions of PowerPoint. The best place to start learning is by purchasing a book (there’s one called “Mastering VBA for Microsoft Office 365” on Amazon or reading the extremely exciting Object Model documentation from Microsoft: https://docs.microsoft.com/en-us/office/vba/api/overview/powerpoint/object-model

Hi Greeting I had made a game in power point using VBA codes. At last it generate a report every time a candidate conduct the game . My requirement is to generate result in same excel sheet after conducting the game. Like Row 1 player 1 result Row 2 player 2 result I need your help Regards

Hi Asheesh. It’s possible to use VBA to get PowerPoint to “talk” to Excel (and other Office apps) but it’s a bit complicated to mention in a comment here. We’d be happy to help if you’d like a quote or if you want to try yourself you could start with this: Set oXL = CreateObject(“Excel.Application”) and have a look at some online examples. I’d also recommend the book “Mastering VBA for Microsoft Office 365” available from Amazon.

If there are two colors of font in the textFrame, how to change the font of one color through VBA?

Hi Bruce. You could either iterate through the Characters collection of the TextRange2 object or the Runs collection which returns all of the TextRanges with the same style. Example: ActiveWindow.Selection.ShapeRange(1).TextFrame2.TextRange.Runs(1).Font.Fill.ForeColor.RGB

Hi – can you help, please?

How can I change the font color and size of the message box? What code will work and where will I put it? Creating an interactive game in powerpoint. Thank you!

—– Sub Correct() Points.Caption = (Points.Caption) + 10 Output = MsgBox(“Your answer is correct, well done!”, vbOKOnly, “Correct Answer”) ActivePresentation.SlideShowWindow.View.Next End Sub

Sub Incorrect() Points.Caption = (Points.Caption) – 5 Output = MsgBox(“Your answer is incorrect.”, vbOKOnly, “Wrong Answer”) ActivePresentation.SlideShowWindow.View.Next End Sub

Sub Reset() SlideLayout.Points.Caption = 0 ActivePresentation.SlideShowWindow.View.Exit End Sub ———-

Thanks for your explanation.

Hi Jamie, Is there any way to keep my macro save in a file so I can utilize on any other PPTs equivalent as.normal.dotm for Word, .xlam(add-in) for Excel.

Hi Anurag. Thanks for the question and Happy New Year! The best way to do this would be to export your project as a ppam and activate it as an add-in via the PowerPoint add-ins UI. Save your ppam in %AppData%\Microsoft\AddIns and then in the Windows PowerPoint Developer tab, click PowerPoint Add-Ins and add your ppam from there. If you’re not code-signing your VBA project, you may need to adjust Trust Centre settings. You could optionally build an EXE/MSI installer package for Windows and PKG for macOS, although that is a more complex topic.

Leave a Reply Cancel reply

Save my name and email in this browser for the next time I comment.

Join the BrightCarbon mailing list for monthly invites and resources

This is awesome! You guys are great to work with and we will absolutely recommend you to others. John Capuano Lone Beacon

powerpoint vba presentations add

powerpoint vba presentations add

  • Charts and Graphs , Excel Howtos , VBA Macros

Create PowerPoint Presentations Automatically using VBA

  • Last updated on May 20, 2020

Chandoo

This is a guest post by Drew Kesler. 

You’ve been there before. It’s almost 5:00, and you are going crazy trying to finish the presentation due for a monthly performance meeting the next morning. The model is refreshed, and now it just takes a LOT of copying, pasting, and positioning to get the PowerPoint ready. Finally, the slides are finished…, until you read a new message from your boss requesting a minor change. But of course her change means you have to start all over with the copy and pastes…

There is always a better way! In the Oil and Gas industry, I constantly have monthly reports to assess the performance of our operating assets. Excel VBA makes it a cinch to automate the entire process. So when a simple change is requested, the presentation is automatically generated with the click of a button. No more wasting time!

So, here it is – How to Save TONS of Time by Using an Excel VBA Macro to Build Your Presentation:

1. Build your charts in Excel

Excel to PowerPoint using VBA - Step 2

3. Open VBA. To do this, you can either press ALT + F11, or you can take the following steps:

Excel to PowerPoint using VBA - Step 3a

7. Now all you need to do is go to Excel and run the CreatePowerPoint macro! To make this easy, draw a rectangle shape in your Excel worksheet which contains all the charts you want to export to PowerPoint.

Excel to PowerPoint using VBA - Step 7

Download the Example Workbook & Play with this Macro

Click here to download the example workbook and play with the macro .

Note: If you have an error with Power Point application activation, use this code instead.

Thanks Drew

Thank you so much Drew for writing this insightful article and showing us how to automate PPT Creation thru Excel VBA. I have really enjoyed playing this idea. And I am sure our readers will also like it.

If you like this technique, say thanks to Drew.

How do you Automate PPT Creation?

During my day job, I used to make a lot of presentations. But each one was different. So I used to spend hours crafting them.

And nowadays, I hardly make a presentation. But I know many of you make PPTs day in day out. And this technique presented by Drew is a very powerful way to save time.

Do you use macros to automate creation of presentations? What are your favorite tricks & ideas? Please share using comments.

Learn More VBA – Sign-up for our VBA Class Waiting List

Chandoo.org runs a VBA Class that teaches you from scratch, how to build macros to save time & automate your work. We opened our first batch in May this year and had an excellent response. More than 650 students signed up and are now learning VBA each day.

If you want to learn VBA & advanced Excel, this is a very good class to join.

Click here for full information on VBA classes .

About the Author:

Drew Kesler specializes in process automation and data visualization. He currently performs analytics and modeling for the Oil and Gas industry. His most recent projects include using GIS mapping technology to visualize data and enhance interaction across organizations.

Share this tip with your colleagues

Excel and Power BI tips - Chandoo.org Newsletter

Get FREE Excel + Power BI Tips

Simple, fun and useful emails, once per week. Learn & be awesome.

  • 212 Comments
  • Ask a question or say something...
  • Tagged under advanced excel , Automation , charting , downloads , guest posts , Learn Excel , macros , powerpoint
  • Category: Charts and Graphs , Excel Howtos , VBA Macros

powerpoint vba presentations add

Welcome to Chandoo.org

Thank you so much for visiting. My aim is to make you awesome in Excel & Power BI. I do this by sharing videos, tips, examples and downloads on this website. There are more than 1,000 pages with all things Excel, Power BI, Dashboards & VBA here. Go ahead and spend few minutes to be AWESOME. Read my story • FREE Excel tips book

powerpoint vba presentations add

Want an AWESOME Excel Class?

Advanced Excel & Dashboards training - Excel School is here

– Brenda

FREE Goodies for you...

Excel formula list - 100+ examples and howto guide for you

From simple to complex, there is a formula for every occasion. Check out the list now.

powerpoint vba presentations add

Calendars, invoices, trackers and much more. All free, fun and fantastic.

Advanced Pivot Table tricks

Power Query, Data model, DAX, Filters, Slicers, Conditional formats and beautiful charts. It's all here.

powerpoint vba presentations add

Still on fence about Power BI? In this getting started guide, learn what is Power BI, how to get it and how to create your first report from scratch.

no-spill-error-after-converting-to-range

How to fix SPILL Error in Excel Tables (3 easy solutions)

So you have a SPILL error in your Excel tables? In this quick article, let me show you 3 easy fixes to the problem. Fix

Loan Amortization Schedule in Excel

Loan Amortization Schedule in Excel – FREE Template

How-to create dependent drop downs in excel [dynamic & multiple].

powerpoint vba presentations add

VLOOKUP(), MATCH() and INDEX() – explained in plain English

STAFF-ROSTER-TEMPLATE

Beautiful Staff Roster Excel Template [FREE Download]

  • Excel for beginners
  • Advanced Excel Skills
  • Excel Dashboards
  • Complete guide to Pivot Tables
  • Top 10 Excel Formulas
  • Excel Shortcuts
  • #Awesome Budget vs. Actual Chart
  • 40+ VBA Examples

Related Tips

time between two dates excel formula

How to calculate time between two dates in Years, Months & Days [Excel Formula]

Make an impressive interactive map chart in excel.

Dynamic Business Dashboard

How to Create a Dynamic Excel Dashboard in Just 5 Steps

Speed up Excel Formulas - 10 Practical Tips

Speed up your Excel Formulas [10 Practical Tips]

212 responses to “create powerpoint presentations automatically using vba”.

' src=

Hmmm...whilst that'd be very handy sometimes, I've often found it's quicker and easier to simply link the charts to a PowerPoint, meaning that any time you update the chart, you update the PPT too.

' src=

Wondering if there is a way to actually use excel slicers while in PowerPoint Presentation mode. I figured out how to incorporate the slicers into the PPT but when you switch to presentation mode, you can't click on an fields to change the details. Anyone know if this can be done?

' src=

we have prepared a simple and useful solution for that issue. Check the following video, where its presented: http://www.youtube.com/watch?v=inBBlpd9qQ4

You will find the contact information and we will provide you that Add-in.

Than really saves you a lot of time!!

' src=

I want to create a ppt but to take each chart and table from every sheet. how can I do it?

question 2: If my ppt already exists and there has been a change in the data, I need the charts and tables to only update in my ppt. how do you suggest I solve it?

' src=

Hey here is a "cool" VBA-Code to create on the first slide thumbnails of all slides ! Regards Stef@n

Sub thumbnails() Dim strPath As String Dim i As Integer Dim n As Integer Dim sld As Slide

strPath = ActivePresentation.Path n = ActivePresentation.Slides.Count

ActivePresentation.SaveAs FileName:=strPath & "\Test.png", _ FileFormat:=ppSaveAsPNG, EmbedTrueTypeFonts:=msoFalse Set sld = ActivePresentation.Slides.Add(1, ppLayoutBlank) For i = 1 To n sld.Shapes.AddPicture FileName:=strPath & "\Test\slide" & i & _ ".PNG", LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=i * 30, _ Top:=i * 30, Width:=144, Height:=108 Next i End Sub

' src=

Hi, I can't make it work. 🙁 I get the error 424: Object required. I suppose this is because of an object library is not properly referenced, but which?   Thanks!

' src=

I too am getting this error and can get the sample file to work. This would be great for a project I am currently working on.

' src=

It is not clear to me from the trailing posts if the problem with the above not working has been fixed. However, the slightly modified code below works with Office 2010 (Powerpoint), and produces a slide with thumbnails (iMaxSlidesHorizontal (8) to a row).

Sub thumbnails()

Dim iFullHeight As Integer iFullHeight = 0 Dim iFullWidth As Integer iFullWidth = 0

Dim iHeight As Integer iHeight = 108 Dim iHSpacing As Integer iHSpacing = 10

Dim iMaxSlidesHorizontal As Integer iMaxSlidesHorizontal = 8 Dim iVSpacing As Integer iVSpacing = 10 Dim iWidth As Integer iWidth = 144 Dim n As Integer n = ActivePresentation.Slides.Count Dim strPath As String strPath = ActivePresentation.Path

Dim sld As Slide Dim i As Integer

Dim iSlidesHorizontal As Integer iSlidesHorizontal = 0 Dim iSlidesVertical As Integer iSlidesVertical = 0

ActivePresentation.SaveAs FileName:=strPath & "\Test.PNG", FileFormat:=ppSaveAsPNG, EmbedTrueTypeFonts:=msoFalse Set sld = ActivePresentation.Slides.Add(1, ppLayoutBlank)

For i = 1 To n

sld.Shapes.AddPicture FileName:=strPath & "\Test\slide" _ & i _ & ".PNG", _ LinkToFile:=msoFalse, _ SaveWithDocument:=msoTrue, _ Left:=iSlidesHorizontal * (iWidth + iHSpacing), Top:=iSlidesVertical * (iHeight + iVSpacing), _ Width:=iWidth, _ Height:=iHeight

iSlidesHorizontal = iSlidesHorizontal + 1

If iSlidesHorizontal >= iMaxSlideHorizontal Then

iSlidesHorizontal = 0 iSlidesVertical = iSlidesVertical + 1

' src=

this code says runtime error 429 ActiveX component cant create object. can you please help

@ steve i agree ! regards Stef@n

' src=

On occasions I have to create a large number of photo sheets for inclusion in a report. That is, a page with one or two photos and a description. Using a list in an excel spreadsheet that gives the file name for the photo and a description I written a macro to generate a powerpoint presentation that can be saved as a pdf or printed out. Any changes to photo or description are simple to do in the list.

' src=

Datapig had a similar method.

http://datapigtechnologies.com/blog/index.php/creating-a-powepoint-deck-in-excel/

This works in 2003

' src=

I downloaded the example spreadsheet in Create PowerPoint Presentations Automatically using VBA. Excel says this file is not in Excel format even though it has an .xls extension. I am using Excel2003. Any ideas?

' src=

How do you copy charts from excel into PowerPoint as ChartObjects (not metafile or linked image)? In excel 2003 we had the graph engine which enabled us to paste the chart data into Graph.DataSheet. Whats the equivalent in Office 2010??

' src=

I have a few large presentations (~300 slides). My approach was to make a chart for every possible permutation, then link them all into PowerPoint. The powerPoint works like a website, so the user can click around to get to the chart they are interested in within 1-2 clicks.

Unfortunately, this approach doesn't seem to work in Office 2007. First, it takes forever to update the links, if it does it at all. Second, once they are updated, when you go into slide show view in PowerPoint the fonts are all fuzzy (I've looked into this and it has something to do with the way PP07 scales the slides). There appears to be no solution to this so now I need a new approach...

I've tested the following approach a little and it seems to work. I have a sub that exports all the charts out as images:

Sub Export2Image() Dim oCht As ChartObject Dim flPath As String, fName As String Dim ws As Worksheet Dim cs As Chart Dim i As Long flPath = "C:\Excel\Exports" 'Put files in this folder ChDir flPath For Each cs In ActiveWorkbook.Charts i = i + 1 fName = cs.Name & i & ".jpg" cs.Export Filename:=fName, FilterName:="jpg" Next For Each ws In ActiveWorkbook.Worksheets For Each oCht In ws.ChartObjects i = i + 1 fName = ws.Name & i & ".jpg" oCht.Chart.Export Filename:=fName, FilterName:="jpg" Next Next

'MsgBox ("All workbook charts have been exported as images to ") & flPath & ".", vbOKOnly

Then in PowerPoint I link to the image on the file server. The only problem I've noticed is some of the charts have the little red "X" in the corner, but it goes away after a second or two. Though this approach seems to be viable, I am open to other suggestions. I tried the code above, but it doesn't really work for me because I have set slides with set text, I only need to update the chart.

' src=

@GrahamG : Can you share a file and procedure as you mentioned on your comment?

@Drew: Wow thanks for sharing the info...you're a life saver.

Can someone post on how to modify the VB script for the case below:

If you have a mixture of Chart and Picture in your workbook or if you have pictures only.

Meaning the presentation should be created using the pictures from excel the excel workbook, with comments as on the example sheet ofcourse.

Please help!!!

' src=

Thanks Drew, Its really useful code to work on powerpoint. If we can export it to excel again it may be awesome.

' src=

My choice is steve's because most ofthen than not you have made other customization on the powerpoint slide/chart.

But it is great to know new technique.

' src=

@Donald: Use the CopyPicture method. For example, if you go into drew's code, you will see the line: ActiveChart.ChartArea.Copy Change that to the following line: Sheet1.Range("A1:I19").CopyPicture xlScreen, xlPicture ------------------------------------------------------------------------------ Note that when you run the program it copies the contents of A1:I19 onto your presentation from Sheet1. Hope that helps!

Here's a link to the CopyPicture method: http://msdn.microsoft.com/en-us/library/bb148266.aspx .

Also, I've used and much prefer Drew's method overall. If your PowerPoint presentation is a report, then linking to the data source isn't always best when you need to send the presentation to your client or to another office branch, both of which might be outside of your network. Furthermore, generating a new presentation upon changes effectively creates an historical record. And finally, creating a presentation that isn't linked to the data source "walls off" your actual data such that nefarious and reckless can't harm it!

' src=

nice post. I have done something similar on my blog:

http://www.clearlyandsimply.com/clearly_and_simply/2010/03/export-microsoft-excel-dashboards-to-powerpoint.html

I thought you might be interested.

Along the same lines: I also had an article describing how to export a Microsoft Project Gantt chartto PowerPoint.

The interesting part of the Project VBA export procedure is the fact that it does not export the Gantt as a picture. It rather creates a project plan in PowerPoint consisting of PPT objects like textboxes, rectangles, triangles and diamonds. You can format, align, rearrange, group and resize them, add annotations, delete single items, etc. in PowerPoint.

This may be a bit off topic, because Chandoo.org is a Microsoft Excel blog, but if you are using Microsoft Project, too, you may want to have a look:

http://www.clearlyandsimply.com/clearly_and_simply/2009/03/gantt-charts-are-learning-to-fly.html

' src=

thanks for sharing the trick. However, is it possible to export in a chart format instead of picture format?

' src=

@ drew, THANK YOU for sharing, and starting this thread. @ everyone else, yes there are different ways of doing things. Sometimes your solutions would be better than drew's and sometimes drew's will be a better method. thanks for sharing your solutions @chandoo/hui can you make it easy to understand each option by expanding on this thread?

' src=

Select your chart in Excel, Go to PowerPoint and do Paste Special> Choose PasteLink> Choose Microsoft Excel Chart Object. You are done.

Now whenever you change your excel, just update link of Powerpoint. Your Chart will instantly updated.

' src=

hay its cool but it uses blank PPT tamplate what about using Companys own PPt Tamplet

[...] link [...]

@FINCRIBE create and save the PPT-Template as a POT-file Regards Stef@n

' src=

is it possible to modify the VBA to copy all charts from all worksheets into 1 single powerpoint file?

reason is that multiple charts are scattered across few worksheets and it'd be easier (or lazier) to copy ALL charts 😛

btw, any chance to perform similar copy-n-paste to Outlook Email (HTML)?

as u know, bosses hate to open attachments and would rather browse the charts via Blackberry!!

' src=

I've used this post to great effect already - many thanks for sharing!

I was wondering if the code could be modified so that rather than exporting charts to powerpoint, you could export a table?

noticed there is a bug/limitation.

if a chart is smaller than a powerpoint slide size, it works.

however, if a chart (or combo grouped-charts) is large, the VBA will not run.

error box: "Run-time error -2147418113 (8000ffff)': Method 'Copy' of object 'ChartArea' failed"

if i Debug, it will point to "ActiveChart.ChartArea.Copy"

' src=

@Davidlim: If you look on the earlier comments, robert posted a similar tehnique and on his example he has the chart/pic on different worksheets. When you execure the VB script it gives you option to open your existing template/file where the slide will be added last, meaning your presetation backround remains. or if you click cancel it creates a completely new presentation. on his Excel file he uses the names. Go to this link for more info and for the file download.

It's very interesting.

Thanks to all that contribute to these comments and I'm glad that through chandoo we get help. http://www.clearlyandsimply.com/clearly_and_simply/2010/03/export-microsoft-excel-dashboards-to-powerpoint.html

' src=

Hi Chandoo,

It works perfectly. Is there a way out to export tables from excel 2007 to PPT using Macros & the exported tables shld be in editable form in PPT.

' src=

Does anyone know how you would adjust the code for this to pick up a camera tool snapshot instead?

' src=

How doe we chnage the data dynamically in the PPT iteslef so that the graphs get modifed .Becuase currently it gor imported as an image .To chnage i have to go back to excel chnage teh data and again export .

Are there any way to chnage the values in the PPT and create the graph then and there in the PPT itself

' src=

Hi Pankaj, I might be too late to respond ... By now you might have got your answer as well. Modify the below: activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select to: activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture, Link:=msoTrue).Select -DG.

' src=

Love it - thanks for the tip - owe you a beer 😉

' src=

How can we do it for pictures (map objects)? Anone can help thanks in advance

' src=

Great tip and is very helpful - I have a standard company template and would like to automatically place the graphs and text into this could any one please advise how this can be done with adding to the VBA code supplied.

Many Thanks

If any body can demonstrate as I have not got my answer i.e. how to automatically place the picture (bitmap) and text associated with picture in ppt. Drew and Chandoo please help

' src=

How can use this same methond to copy range of cells?

' src=

***William - First, Use this function:

Function CopyPaste(slide, selection, aheight, awidth, atop, aleft) Set PPApp = GetObject(, "Powerpoint.Application") Set PPPres = PPApp.ActivePresentation PPApp.Activate Set PPSlide = PPPres.Slides(PPApp.ActiveWindow.selection.SlideRange.SlideIndex) PPApp.ActiveWindow.View.GotoSlide (PPPres.Slides.Count) PPApp.Activate PPApp.ActiveWindow.View.GotoSlide (slide) ' Reference LAST slide Set PPSlide = PPPres.Slides(PPApp.ActiveWindow.selection.SlideRange.SlideIndex) selection.CopyPicture Appearance:=xlScreen, _ Format:=xlBitmap PPSlide.Shapes.Paste.Select

Set sr = PPApp.ActiveWindow.selection.ShapeRange ' Resize: sr.Height = aheight sr.Width = awidth If sr.Width > 700 Then sr.Width = 700 End If If sr.Height > 420 Then sr.Height = 420 End If ' Realign: sr.Align msoAlignCenters, True 'sr.Align msoAlignMiddles, True sr.Top = atop ' If aleft 0 Then sr.Left = aleft '50 End If If Not IsMissing(drawBorder) Then

'Draw border for the shape range With sr.Line .Style = msoLineThinThin .Weight = 0.1 .DashStyle = msoLineSolid .ForeColor.RGB = RGB(0, 0, 0) End With End If ' Clean up Set PPSlide = Nothing Set PPPres = Nothing Set PPApp = Nothing End Function

THEN, this line in your code:

CopyPaste slide, selection, 200, 700, 82, 10 'this copies the Selected Range

*** IF you want a working file - please let me know if you want to know how to make this dynamic, please let me know so that I can email you the working file..

' src=

@Sai Swaroop Hey Sai, if you are still able I would really appreciate getting a working copy of that excel sheet. Thanks

' src=

Please e-mail me the working file.   [email protected]  

' src=

Please send me the working file... tq.. really need this....

' src=

I need to export a few hundred graphs from excel and put 5 to a page in powerpoint. The graphs need to be a specified size with a black border. Can anyone provide the visual basic code to accomplish this?

' src=

Hi. I am working with a project where we create several summary reports and graphs based on a set of Raw data. Up until recently we have been using a manual process to copy paste these in Powerpoint. Could someone tell me how to copy tables and graphs over several worksheets into one powerpoint presentation please? I have tried the Macro for charts and it works great but wondered if someone could show how to make it work for tables and other data on excel.

Is it also possible for the presentation to change dynamically as the raw data chagnes? Thanks, Swetha

' src=

I have the same issue as Pankaj - how can we update the code to paste it as a Chart object that can be edited in PowerPoint (linked or the Excel file or unlinked, doesn't matter). I tried replacing "ppPasteMetafilePicture" with "ppPasteOLEObject" but it's still pasting the charts as pictures. Thanks!

Hi sai swaroop i am interested in working file pls email at [email protected]

' src=

Hi Sai Swaroop,

Can you please email me the working file?

Thanks in advance. Much appreciated.

Regards, Chax. 

hey Chander,

Sent you the file.

' src=

Can you send me the working file thanks

' src=

Can you please send me the working file as I am bumping up with same errors.

Chandar &Sai,

Pls send the working file as I am bumping with invalid shapes error

[email protected]

Hi, I was able to paste the Excel chart into the PowerPoint as a chart object, but I'm having trouble editing it within the presentation. PowerPoint VBA does not seem to allow me to refer to the chart and edit the axis font, etc., but instead edits the axis font size, axis font color of the chart in Excel. I was wondering if anyone could help. This is what I have so far. Thank you!

cht.Select ActiveChart.ChartArea.Copy activeSlide.Shapes.PasteSpecial(DataType:=ppPasteChartObject).Select

'Adjust the positioning of the Chart on Powerpoint Slide newPowerPoint.ActiveWindow.Selection.ShapeRange.Width = 9 * 72 newPowerPoint.ActiveWindow.Selection.ShapeRange.Height = 5 * 72 newPowerPoint.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True newPowerPoint.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True

' src=

i have 5 graphs which should pasted on the PPT in single slide...can we do it automatically?

' src=

I dont know VB scripting or macros, but from what i understand its taking a chart as a object, but i have sheet with a lot of field names & respective numeric values from formuales.

But this code does not work on that, do we need to update this code ?

Or can you provide a new code ? [that would be of gr8 help] or if its there on your website wats the link coz i was unable to find it.

I am into software testing so we deal with a lot of data & numeric values & less of charts..........plz assist

And request you to post entries specific to the filed of software testing. We are always on the look out of process enhancements which helps improve efficiency specially if its saving time for the project.

' src=

Here is how to copy past the chart as an actual chart rather than the picture. The pasted chart will be linked to the excel sheet, so any change in the excel sheet will be reflected on the chart.

'Copy the chart and paste it into the PowerPoint as linked charts cht.Select ActiveChart.ChartArea.Copy

activeSlide.Shapes.Paste ' This new pasted chart is actually linked to the excel sheet With activeSlide.Shapes(activeSlide.Shapes.Count) 'The chart that was just pasted .Left = 15 .Top = 125 End With

' src=

really cool....this website has wonderful tips and tricks :). Thank you a ton!

' src=

Can I put several graphs on one slide

' src=

How can this be done using Excel 2003? I have tried but keep getting the error: Missing:Microsoft Powerpoint 12.0 Object Library. How can I fix this?

Hey Brian. You'll need to reference the correct Powerpoint library. Like in the example above, you'll first, go into the VBA editor. From there you'll select the Tools menu item and click "References...."

Now, you should see something like "MISSING: Missing:Microsoft Powerpoint 12.0 Object Library" in the list box. De-select it. Now scroll down and look for something like "Microsoft Powerpoint ## Object Library" (where the # is a number). Most likely, if you're using Excel 2003, it will be "Microsoft PowerPoint 9.0 Object Library."

' src=

@ graham I am interested to do the same. Can you share the file/code with me? Thanks!

' src=

Hi I need to loop through all the sheets in a work book and copy all the charts from one sheet to one Slide. Could u help??

see above Sub thumbnails() Dim strPath As String Dim i As Integer Dim n As Integer Dim sld As Slide

ActivePresentation.SaveAs FileName:=strPath & “\Test.png”, _ FileFormat:=ppSaveAsPNG, EmbedTrueTypeFonts:=msoFalse Set sld = ActivePresentation.Slides.Add(1, ppLayoutBlank) For i = 1 To n sld.Shapes.AddPicture FileName:=strPath & “\Test\slide” & i & _ “.PNG”, LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=i * 30, _ Top:=i * 30, Width:=144, Height:=108 Next i End Sub

' src=

im using a excel for mac 2011, and I can't get it to work - i keep getting this error: compile method or data member not found

and it highlights the PasteSpecial in the code!

can someone please let me know how to fix this?

any help would be much appreciated

' src=

Hi, did you ever get to the bottom of this ? I've got the same problem.   thanks   Paul

' src=

did you manage to solve this by any chance?

' src=

i would like to add a code to use a particular template shown in the following:   PowerPoint.Application.ActivePresentation.ApplyTemplate "C:\Documents and Settings\myfile\Application Data\Microsoft\Templates\ShortTitle.pot"

But i'm getting a 429 error, claiming the ActiveX component cannot create the object.

What else can i do please?

' src=

Below is the code I use to open up a PP template. Also, Under Tools > References, you need to make sure the Microsoft PowerPoint 14.0 Object Library is checked. 

 Dim newPowerPoint As PowerPoint.Application         Dim pptPres As PowerPoint.Presentation         Dim activeSlide As PowerPoint.Slide         Dim cht As Excel.ChartObject         Dim file As String         file = "C:\Users\jbain\Documents\PowerPoint template_Span.pptx"         Dim pptcht As PowerPoint.Chart               'Look for existing instance         On Error Resume Next         Set newPowerPoint = GetObject(, "PowerPoint.Application")         On Error GoTo 0           'Let's create a new PowerPoint         If newPowerPoint Is Nothing Then             Set newPowerPoint = New PowerPoint.Application         End If     'Make a presentation in PowerPoint         If newPowerPoint.Presentations.Count = 0 Then         Set pptPres = newPowerPoint.Presentations.Open(file)         End If           'Show the PowerPoint         newPowerPoint.Visible = True 

hi Jenn, thank you for your reply. in the Tools > Reference, i only find Microsoft PowerPoint 12.0 Object Library. How do i get hold of Microsoft PowerPoint 14.0 Object Library please?

i'm using Office 2007.

Hi Aaron, I believe you are using Office 2007 and Jenn's using 2010. Hence the difference in Object Library version. You can try using Microsoft PowerPoint 12.0 Object Library and try. Please modify: PowerPoint.Application.ActivePresentation.ApplyTemplate “C:\Documents and Settings\myfile\Application Data\Microsoft\Templates\ShortTitle.pot” to: PowerPoint.ActivePresentation.ApplyTemplate “C:\Documents and Settings\myfile\Application Data\Microsoft\Templates\ShortTitle.pot” -DG.

thank you for your suggestion. i tried the modification, and now the error claims: '429' error. ActiveX component cannot create object.

highlighsts the code: PowerPoint.ActivePresentation.ApplyTemplate “C:\Documents and Settings\myfile\Application Data\Microsoft\Templates\ShortTitle.pot”

Any other suggestions i can try please?

' src=

Sub PushChartsToPPT() 'Set reference to 'Microsoft PowerPoint 12.0 Object Library' 'in the VBE via Tools > References... ' Dim ppt As PowerPoint.Application Dim pptPres As PowerPoint.Presentation Dim pptSld As PowerPoint.Slide Dim pptCL As PowerPoint.CustomLayout Dim pptShp As PowerPoint.Shape

Dim cht As Chart Dim ws As Worksheet Dim i As Long

Dim strPptTemplatePath As String

strPptTemplatePath = "E:\DC++ Downloads\Intern\Ormax\Macro\demo template.pptx"

'Get the PowerPoint Application object: Set ppt = CreateObject("PowerPoint.Application") ppt.Visible = msoTrue Set pptPres = ppt.Presentations.Open(strPptTemplatePath, untitled:=msoTrue)

'Get a Custom Layout: For Each pptCL In pptPres.SlideMaster.CustomLayouts If pptCL.Name = "Title and Content" Then Exit For Next pptCL

'Copy ALL charts in Chart Sheets: For Each cht In ActiveWorkbook.Charts Set pptSld = pptPres.Slides.AddSlide(pptPres.Slides.Count + 1, pptCL) pptSld.Select

For Each pptShp In pptSld.Shapes.Placeholders If pptShp.PlaceholderFormat.Type = ppPlaceholderObject Then Exit For Next pptShp If pptShp Is Nothing Then Stop

cht.ChartArea.Copy ppt.Activate pptShp.Select ppt.Windows(1).View.Paste Next cht

'Copy ALL charts embedded in EACH WorkSheet: For Each ws In ActiveWorkbook.Worksheets For i = 1 To ws.ChartObjects.Count Set pptSld = pptPres.Slides.AddSlide(pptPres.Slides.Count + 1, pptCL) pptSld.Select

For Each pptShp In pptSld.Shapes.Placeholders If pptShp.PlaceholderFormat.Type = ppPlaceholderObject Then Exit For Next pptShp

Set cht = ws.ChartObjects(i).Chart cht.ChartArea.Copy ppt.Activate pptShp.Select ppt.Windows(1).View.Paste Next i Next ws End Sub

I am using this code to link charts from excel to powerpoint. But this is inserting charts to last slide. Can anyone suggest me the changes so that i get charts to link with ppt to custom slide number and in mid of some saved template. Thanks in advance.

I have Microsoft 2010, which may be why mine is 14.0. Your version should work as well. The main thing is that the PowerPoint object library is references because the VBA code includes references to PowerPoint objects. 

Hi Aaron,   Apologies for the delay in response. Please try: newPowerPoint.ActivePresentation.ApplyTemplate "C:\Documents and Settings\myfile\Application Data\Microsoft\Templates\ShortTitle.pot"

thanks for your reply. i've tried it with the suggestion, but this time, error msg is: Operating error: -2147188160 (80048240)': Presentation (unknown member): Invalid request. PowerPoint could not open the file.

highlights the code: newPowerPoint.ActivePresentation.ApplyTemplate “C:\Documents and Settings\myfile\Application Data\Microsoft\Templates\ShortTitle.pot”

My codes as below. Is it possible you can find some error in the coding please?: 'First we declare the variables we will be using         Dim newPowerPoint As PowerPoint.Application         Dim activeSlide As PowerPoint.Slide         Dim cht As Excel.ChartObject         Dim trfnum As String 'Variable to obtain Report #         Dim trfname As String 'Variable to obtain Report Title                                   trfnum = Range("K5").Value 'Assign/Obtain Report# from Cell K5              trfname = Range("K4").Value              trfprojnum = Range("K11").Value              trfpartnum = Range("K12").Value              trfsnnum = Range("K13").Value              trfmodelnum = Range("K14").Value                   'Look for existing instance         On Error Resume Next         Set newPowerPoint = GetObject(, "PowerPoint.Application")         On Error GoTo 0          'Let's create a new PowerPoint         If newPowerPoint Is Nothing Then             Set newPowerPoint = New PowerPoint.Application             End If             'Make a presentation in PowerPoint         If newPowerPoint.Presentations.Count = 0 Then             newPowerPoint.Presentations.Add         End If              'Show the PowerPoint         newPowerPoint.Visible = True         ' apply a slide template     newPowerPoint.ActivePresentation.ApplyTemplate "C:\Documents and Settings\myfile\Application Data\Microsoft\Templates\ShortTitle.pot"     regards, Aaron

Hi Jenn, thanks for your response.

i tried with the code you shared, but VBA has prompt me the following error: Presentations (unknown member) : Invalid request. The PowerPoint Frame window does not exist.

It then highlights the code line:    Set pptPres = newPowerPoint.Presentations.Open(file)

What else can i try to resolve this error please?

' src=

Is there a way to insert the graph in a previously saved powerpoint  instead of creating a new powerpoint?

Scratch the last question.

Does anyone know how to automatically insert the chart into the middle of a saved powerpoint instead of the end?

' src=

Thanks for the code; it worked great until I upgraded my Outlook from 2007 to 2010 (did not upgrade PP or Excel, they are still 2007). Now I get a runtime 430 error- Class does not support Automation or does not support expected interface. Any ideas on how to fix? Thanks!  

Hi Kim, Not sure if you are using any ADOs (ActiveX Data Objects) in your code. Please do the following steps: In the VBE (Visual Basic Editor), select Tools > References ... > Microsoft ActiveX Data Objects x.x Library Take the latest version. I have seen many versions of the same. Below link gives you an explanation about why the error occurs: http://makebarcode.com/info/appnote/app_017.html

' src=

I do have one question, from the initial source code : How to modify the code to have the idea but with pictures. no charts So each time the code detect an image on the sheet it will create a new slide?   thanks in advance.  

' src=

I've tried everything I can think of...how is it (with the code presented) that you are getting the words to the right of the charts to go into PowerPoint as a separate object?

It works perfectly with your charts in your spreadsheet, but for the life of me I have not been able to replicate the behavior in my own spreadsheets.

@Chandoo: I am not able to see the updated comments in this page. Is there an issue from my side? Please let me know. Thank you. @Aaron: I believe you are using Office 2007. So, not sure about the extension of the template file. Please check the extension and change the same. Here, in your case, instead of "ShortTitle.pot" it may be "ShortTitle.potx". -DG

  Overall rating     This site has no rating (not enough votes)    

Hi Dolphin, Thanks for your kind response and reminder. it works now!

Glad it worked! Anytime to help 🙂

' src=

Hello. I was trying to modify the supplied code for my purposes but kept hitting snags. As such, I am seeking some help with the following: I have an Excel workbook with various named worksheets and want to copy and paste the print ranges from each worksheet into an existing PowerPoint template using VBA. So, if worksheet “A”s print range is set to print on one page and worksheet “B”s print range is set to print on 3 pages, the PowerPoint presentation should have a total of 4 slides. I could end up with 10 worksheets in total representing 10+ slides needed in the presentation. Am new to VBA and would appreciate the help.

Apologies in my delayed response. Can you provide me the sample file(s), Excel and Powerpoint ones? Let me take a look and try my best.

Thanks for offering to look at the code for me. Where should I send the sample files?

' src=

@Al Refer: http://chandoo.org/forums/topic/posting-a-sample-workbook

Please send it to my email ID, [email protected]

' src=

How can I change the code so it copy and pastes only one specific chart, instead of all the charts?

Hi Ryan,   `'Declare the variable` `Dim ObjChartObject As Excel.ChartObject`   `Set ObjChartObject = Worksheets("WorksheetName").ChartObjects("ChartName")` `ObjChartObject.Chart.ChartArea.Copy` `.` `.` `.` `.` `Continue your code`   Hope this helps.   -DG

' src=

That is a very handy tool.... saved my@$$ 

does anyone know how to modify to always open a new power point .  If ran a second time charts are tacked to the previously created presentation.

Hi, The code that was provided in this example does the same. Please see point 5, you have the entire code. In the code, look for the section - 'Make a presentation in PowerPoint'

Revert back if you are not able to understand.

is there a way to lock out any user input while code is running. if i scroll while charts are moving to the power point the code stops.

Please try the below: 'Type this at the beginning of your code. Application.Interactive = False ... <Your code here> ... <Your code here> ... <Your code here> 'Type this at the end of your code. Application.Interactive = True

Hope this helps.

nope. user input still kills the macro. is there a way to not have screenupdating with powerpoint? or soemthing similar?

it only happens with the transfer from excel to power point. is there a way to have power point come up in a minimized state to at least minimize user interaction?

In the code presented in this example, goto: 'Show the PowerPoint

After the line: newPowerPoint.Visible = True

Type: newPowerPoint.WindowState = ppWindowMinimized

This should keep the PowerPoint application in minimized.

' src=

I have (somewhat) of a reverse situation:

I had to create and access an Excel file from PowerPoint.

The first part (not shown) successfully creates a .CSV file containing several lines of data. E.g.:

     12345,John,8009991212,123 Main Street      58145,Mary,3215551212,666 Mockingbird Lane

... etc. ...

The last part of the macro (shown below) successfully opens the .CSV and Personal.XLS (which contains a macro to format the Excel file), saves as an .XLS in XLS format, then runs the macro "CTI_Format_B" to format the .XLS file (freeze header, autofit columns, etc.).

     'PowerPoint: Open Excel .CSV and save to .XLS, run Macro "FileFormatB"      Dim oXL As Excel.Application  ' Excel Application Object      Dim oWB As Excel.Workbook     ' Excel Workbook Object      Dim FileXLS As String, FileCSV as String      FileCSV = Environ("USERPROFILE") & "\" & "SamplePop.CSV"      FileXLS = Left(FileCSV, Len(FileCSV) - 4) & ".xls"        Set oXL = New Excel.Application      oXL.Visible = True

     Set oWB = oXL.Workbooks.Open(oXL.StartupPath & "\Personal.xls")

     Set oWB = oXL.Workbooks.Open(FileCSV)   'open CSV file

     oWB.SaveAs FileName:=FileXLS, FileFormat:=xlNormal      oXL.Run ("Personal.xls!FileFormatB")      oWB.Save      oXL.Visible = True

The macro "FileFormatB" in Personal.xls contains formatting for the newly saved .XLS:

    'Excel macro to format header, etc.     Range("A1:L1").Select   'format header     With Selection         .Font.Bold = True         .Interior.ColorIndex = 6         .Interior.Pattern = xlSolid         .Font.ColorIndex = 5     End With     Rows("2:2").Select     ActiveWindow.FreezePanes = True     Cells.Select     Cells.EntireColumn.AutoFit

What I would like to do is instead of having a separate macro in Personal.xls to format the file and having to open Personal.xls (which is otherwise invisible when run here), I would like to run the same formatting from the original PowerPoint macro which created the file.

How do I run the formatting from the PowerPoint macro to the opened Excel file?

' src=

I would love to use this, but I get error messages even when I try the code on my file or run the downloaded file.  It says user defined type not defined...Any suggestions?  How do I define: Dim newPowerPoint As PowerPoint.Application

' src=

This is a great post!  

My problem is that I would like to copy all charts on every worksheet in Excel to PowerPoint (2010).

There is one chart per worksheet, with certain cells providing the title and axis label text and, of course, the range of cells that the chart is based upon.

My problem is that I ONLY want to include that data when I paste as an embedded (not linked or picture) object into PowerPoint.

Other data that is not directly related to the chart is included in PowerPoint. This is a problem, as I don't want users of PowerPoint to see that data.

Is there any way to ONLY include the cells that the chart is directly based upon?

' src=

I am using similar code (see below) with Excel 14, Powerpoint 14 and Windows XP. I use this to copy/paste about 100 images from Excel to Powerpoint. Sometimes I get this error: "Shapes(unkown member) : Invalid request. The specified data type is unavailable." I can run the exact same code and it works, then run it again and I get this error. And the error happens in different places of the code execution each time (although always on a PasteSpecial line). Sometimes in first loop, sometimes in 15th loop, etc. Sheets("RoleSummary").Range("RoleSummaryTable").Copy

PPApp.ActiveWindow.View.GotoSlide PPApp.ActivePresentation.Slides.Count

PPSlide.Shapes.PasteSpecial (ppPasteEnhancedMetafile)

' src=

Mike, did you find a solution for this problem? I am having the same!

' src=

Have no solution, but it seems to be less prevalent if you close all other Microsoft programs while it is running, including File Explorer.

' src=

Is there a way to force the program to arrange charts by order from which they are located?  If you cut and paste the first chart and execute the macro, it is now the second chart (based on it's last active postion).  If not by modifying the program, is there a way to change the active arrangements of the charts some other way.  Cheers

' src=

When I tried to run this macro in Excel 2007, I received this error message:

Run-time error '429':

ActiveX component can't create object

I have a range of cells (formatted as tables) that need to be copied from a named worksheet (for this post - the worksheet name is 'Summary') and then pasted (with formatting) into an existing powerpoint presentation on a new slide that will allow me to edit.  Can the code be modified to accomplish this task and get rid of the error?

' src=

Hello, I have a excel workbook with multiple sheets that I want to put into PowerPoint that when runs will loop through all sheets so it can be displayed on a hallway monitor. I would like the PPT to change as the information changes in excel sheet. The sheets are updated at beginning of every shift (x3 shifts). This will allow clients to see this information. I have a no budget limit so I am trying to get it done using excel and PowerPoint. At this point I do not have anything other than data in the sheets but will be adding pictures and charts as needed in the near future. Is it possible to just link the sheets, in current order in the workbook to show the sheet and its contents: data, picture and or chart full screen one sheet per slide?  I have read this entire post and the knowledge here is staggering. Any help with this would be greatly appreciated by all those entering them and printing them out each day and shift. John

' src=

hеy i гead thrоugh thіs anԁ i am neω to asp. nеt... i аm tгying to dеvеlоp my fiгst аpp in іt and this is veгy helpful.

Thank уοu foг the tіme уou spent to write this chеcklіst. your аwesomе.

' src=

Instead of this we can use a paste link option on the paste special... If it is a regular report.

' src=

i want 5 charts in slide How can we do this? Give VBA Code for this. It's very important for me. Plz help

' src=

GREAT POST..

Works like a charm!

' src=

Can you please send me the working file?

I have that particular project being worked on by another GURU at this time. I do however have another project that has to do with dynamic arrays and print macro that is just as mind boggling to me if your interested. I have it posted on may 17th. If your interested I have the working file for it and I would be glad to get help on.

' src=

Nice article and nice Q&A along with nice solution. Here is my question(s)

1. I am preparing sales collaterals. One common requirement I have from engineering team is case studies. Case study data changes from time to time (as projects progress.) Asking engineering team to prepare a new slide on case study everytime a customer presentation is to be made is waste of their time.

2. I have a template for case study in power point. (Basically empty shapes and to be filled with bullted text.) Number of shapes and which shape should contain what text and what data is fixed.

3. I have a excel template to capture the engineering projects. This template is extended version of their project review template. Hence engineering team populates it as part of their review meeting.

4. What I want to do is a. Filter and select the case studies I want to include. b. Run a macro such that using the selected case studies, the shapes in the case study template are populated and a stack of slides for case study is generated.

Question: 1. Is it possible to fill in shapes (mainly text boxes in a powerpoint) slide) using VBA macros? 2. has anyone attempted it and a solution is published? 3. Can anyone help?

Hope you've seen my answer below.

Hope I am not late for you.

I have worked on similar kind of thing, but with PivotTables. When you mention filter I assume it is just a Data > Filter on Excel and not PivotTable filter. You can enter text into shapes (textboxes) using VBA. Below is the code:

Dim SlideTitle As String SlideTitle = "Your Title Goes Here" ActiveSlide.Shapes(1).TextFrame.TextRange.Text = SlideTitle

The shape number, in this case, 1, will change based on which shape (textbox) you want to enter. Note that to get a shape number of the desired textbox can take some time. You try this on a trial and error method.

Let me know if you require further more help on this.

' src=

Hi. I'm trying to figure out how to do the same thing in the tutorial but with pivot tables. I have a problem selecting and copying/pasting to the powerpoint. Every time I try selecting, I get a runtime error 458. Can you please help? Thank you1

Can you let me know where exactly you are having this error? Also, would it be possible to share your code? Please let me know.

I actually solved the issue. I will post the code anyway.

I have a question that's unrelated to this tutorial though. I want to create several pivot tables based on the values from three comboboxes. The comboboxes act like the pivot table filters and also a counter for how many pivot tables to make. I just want to know how I would go about programming this.

Code: Sub CreatePowerPoint() Cells.Select Range("D47").Activate Selection.Columns.AutoFit 'Add a reference to the Microsoft PowerPoint Library by: '1. Go to Tools in the VBA menu '2. Click on Reference '3. Scroll down to Microsoft PowerPoint X.0 Object Library, check the box, and press Okay

'First we declare the variables we will be using Dim newPowerPoint As PowerPoint.Application Dim activeSlide As PowerPoint.Slide Dim cht As Excel.PivotTable

'Look for existing instance On Error Resume Next Set newPowerPoint = GetObject(, "PowerPoint.Application") On Error GoTo 0

'Let's create a new PowerPoint If newPowerPoint Is Nothing Then Set newPowerPoint = New PowerPoint.Application End If 'Make a presentation in PowerPoint If newPowerPoint.Presentations.Count = 0 Then newPowerPoint.Presentations.Add End If

'Show the PowerPoint newPowerPoint.Visible = True

'Loop through each chart in the Excel worksheet and paste them into the PowerPoint For Each cht In ActiveSheet.PivotTables

'Add a new slide where we will paste the chart newPowerPoint.ActivePresentation.Slides.Add newPowerPoint.ActivePresentation.Slides.Count + 1, ppLayoutText newPowerPoint.ActiveWindow.View.GotoSlide newPowerPoint.ActivePresentation.Slides.Count Set activeSlide = newPowerPoint.ActivePresentation.Slides(newPowerPoint.ActivePresentation.Slides.Count)

'Copy the chart and paste it into the PowerPoint as a Metafile Picture

Cells(i, 7).Interior.Color = 44 i = i + 1 cht.PivotSelect "", xlDataAndLabel Selection.Copy activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select

'Set the title of the slide the same as the title of the chart activeSlide.Shapes(1).TextFrame.TextRange.Text = cht.Name

'Adjust the positioning of the Chart on Powerpoint Slide newPowerPoint.ActiveWindow.Selection.ShapeRange.Left = 15 newPowerPoint.ActiveWindow.Selection.ShapeRange.Top = 125

activeSlide.Shapes(2).Width = 200 activeSlide.Shapes(2).Left = 505

AppActivate ("Microsoft PowerPoint") Set activeSlide = Nothing Set newPowerPoint = Nothing

' src=

this is great, but when I open excell file on my Mac, I'm gettint error and presentation cannot be done 🙁

Could you please help me?

Thank you, Andy

Please let me know what the error is. Let's try to fix it.

' src=

This is EXACTLY what I am needed. I have been stumbling on trying to create PPT slides with specific ranges based on user input in Excel. I have a Sub to find the list of ranges to copy but have not been able to get them into PPT. I've tried a few other blogs with not much help. This one works PERFECTLY! Thank you for sharing!

' src=

Hi, I am new to VBA. I am unable to plot more charts. If i add a new tab, it copies the chart however fail to copty the comments. I repleated the code and edited. But, Its shwoing error. Pleas ehelp!!

' src=

It copies just the first chart and then it stops giving the following error - Getting Error code 424: Object not found.

Debug points out fail at this statement -

activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select

Try this: Before the line (CODE=VB)activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select(/CODE)

type the following (CODE=VB)activeSlide.Select(/CODE)

Let me know if this works.

' src=

Having the same issue over here but that didn't work. Any suggestions?

' src=

Same error as above...adding the code doesn't help.

I'm quite a newbie...any suggestions?

' src=

Hi all.. Im working on how to export pivot tablesfrom excel to powerpoint. Any one can help?

Im using this code but in this part Set oPPTShape = oPPTFile.Slides(SlideNum).Shapes("PivotTable6")"it says that pivot table is not part of shapes? Please help.....

Sub PPTableMacro()

Dim strPresPath As String, strExcelFilePath As String, strNewPresPath As String strPresPath = "C:\Users\angeline.descalsota\Desktop\AUTOMATION\TransferFailurePPFile.pptx" strNewPresPath = "C:\Users\angeline.descalsota\Desktop\AUTOMATION\TransferFailurePPFile.pptx"

Dim oPPTShape As DataTable

Set oPPTApp = CreateObject("PowerPoint.Application") oPPTApp.Visible = msoTrue Set oPPTFile = oPPTApp.Presentations.Open(strPresPath) SlideNum = 1 oPPTFile.Slides(SlideNum).Select

Set oPPTShape = oPPTFile.Slides(SlideNum).Shapes("PivotTable6")

Sheets("Sheet1").Activate With oPPTShape.Table .Cell(1, 1).Shape.TextFrame.TextRange.Text = Cells(1, 1).Text .Cell(1, 2).Shape.TextFrame.TextRange.Text = Cells(1, 2).Text .Cell(1, 3).Shape.TextFrame.TextRange.Text = Cells(1, 3).Text .Cell(2, 1).Shape.TextFrame.TextRange.Text = Cells(2, 1).Text .Cell(2, 2).Shape.TextFrame.TextRange.Text = Cells(2, 2).Text .Cell(2, 3).Shape.TextFrame.TextRange.Text = Cells(2, 3).Text End With

oPPTFile.SaveAs strNewPresPath oPPTFile.Close oPPTApp.Quit

Set oPPTShape = Nothing Set oPPTFile = Nothing Set oPPTApp = Nothing

MsgBox "Presentation Created", vbOKOnly + vbInformation End Sub

' src=

Hi! Works like a charm! However, I'd like to make a small adjustment and need some help. My goal is to use the same code but clicking the chart itself instead of pushing a button. The point is to only export the chart(s) selected by clicking them one at a time (each slide contains alot of charts).

This part should probably be deleted if possible. I would be annoying to have to switch windows after each click: 'Show the PowerPoint newPowerPoint.Visible = True

I know nothing of VBA but learned some basic programming about 15 years ago so I understand to broad strokes. Please help 🙂

' src=

I did a small bit of playing around and found that there is no simple solution to your problem given Microsoft’s limited capability with their software. The only solution I have found so far that works in a way of how you want it is the following.

1) Each chart cannot be an object on a sheet it needs to be in a chart by itself.

2) Copy and paste the following code into each charts code (rename the variable if you desire)

Dim ClassMod As New ChartEvents

Private Sub Chart_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long) Set ClassMod.Excht = ActiveChart End Sub

3) Create a class named ChartEvents (unless you are going to change the variables) and then copy and paste the following modified code (Originally the code Drew posted)

Public WithEvents Excht As Chart

Private Sub Excht_MouseDown(ByVal Button As Long, ByVal Shift As Long, ByVal x As Long, ByVal y As Long)

'Add a reference to the Microsoft PowerPoint Library by: '1. Go to Tools in the VBA menu '2. Click on Reference '3. Scroll down to Microsoft PowerPoint X.0 Object Library, check the box, and press Okay

'First we declare the variables we will be using Dim newPowerPoint As PowerPoint.Application Dim activeSlide As PowerPoint.Slide Dim cht As Application

'Add a new slide where we will paste the chart newPowerPoint.ActivePresentation.Slides.Add newPowerPoint.ActivePresentation.Slides.Count + 1, ppLayoutBlank newPowerPoint.ActiveWindow.View.GotoSlide newPowerPoint.ActivePresentation.Slides.Count Set activeSlide = newPowerPoint.ActivePresentation.Slides(newPowerPoint.ActivePresentation.Slides.Count)

'Copy the chart and paste it into the PowerPoint as a Metafile Picture ActiveChart.ChartArea.Copy activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select

'Adjust the positioning of the Chart on Powerpoint Slide newPowerPoint.ActiveWindow.Selection.ShapeRange.Left = 15 newPowerPoint.ActiveWindow.Selection.ShapeRange.Top = 100

activeSlide.Shapes(1).Width = 500 activeSlide.Shapes(1).Left = 115

AppActivate ("Microsoft PowerPoint") Set activeSlide = Nothing Set newPowerPoint = Nothing End Sub

4) Make sure to save your workbook as a macro enabled excel file or else you will have to do it all over again.

When you change your chart and then click on the chart the first time it will create a new presentation with the chart centered for the most part (fine tune the size and location as desired). Presently this is the only way I have discovered to accomplish this. If there was a way to create a custom handle for objects on a excel sheet this would have been easier.

I hope this helps. Blank

' src=

Very interesting approach. This article is old but looks interesting to me even today. I envision to create dashboards automatically in PowerPoint using this method and getting the data from Excel but with one of our PowerPoint templates.

Julian @ SlideModel

' src=

This really a very nice post and saved me a lot of time.

Thanksss sooo much guys for posting this!!.

I have 32 graphs, to be pasted on 16 slides ( 2 slide each) and some static introductory slides. in total 19 slides.

Please help me on this one.

Thanks in advance Vicky

' src=

hi, i having problems with callout text , if I try to add more text this doesnt take in account, how you deal with this or wich is the trick?

' src=

Wonderfull trick, will save me a lot of effort 🙂

I would like to name the generated ppt depending on the chart title. can anybody tell me how?

@Wouter: Check if the below code works for you:

[code] If Worksheets("Sheet1").ChartObjects(1).Chart.HasTitle Then strChartTitle = Worksheets("Sheet1").ChartObjects(1).Chart.ChartTitle.Text Else strChartTitle = "My Chart Title" End If [/code]

Change the name of the Sheet where you have the chart. Let me know if this works.

hm I want to change the name of the PPT not the sheet, will this do the trick?

Please see below: Assuming you have Test folder in C Drive,

For 97-2003 PowerPoint file, use newPowerPoint.ActivePresentation.SaveAs "C:\Test\Test.ppt"

For 2007 and above PowerPoint file, use newPowerPoint.ActivePresentation.SaveAs "C:\Test\Test.pptx"

' src=

i want this method in ms access vba can u help me Please?

Thanks Drew for the code but i am getting error at line "Dim newPowerPoint As PowerPoint.Application". Error box showing message as Complie error Useer-defined type not defined. Can you tell me whats the problem ?

I may be late. Probably you may need to add the reference of Microsoft PowerPoint XX.0 (whichever version you are having). To add, do the following: In Visual Basic Editor, Click on Tools > References then look for Microsoft PowerPoint under the list in Available References. Hope this helps.

Regards, DG

' src=

Thanks for your work. Just upgraded from 2007 to 2010 at the office and the macros did not work. Turns out copying and pasting in VBA IS different between 2007 and 2010. I was pasting both tables first copied as pictures in excel and then charts copied to PP. File had about 50 images, and was blowing up from 2M to 13M! This gave me some insight into how to address this. The same copy and paste command does not work for copying table ranges and chart images. Furthermore, your pastespecial command for pasting into PP enabled me to research other data types and find one that got the file size back down.

Thanks, Steve

' src=

I have a excel sheet named "Graph" containing charts in matrix form 30 rows and 5 columns(ie 5 charts in first row, 5 charts in 2nd row and so on). I want to make a powerpoint with 9 charts in each slide(5 charts from first row and remaining 4 charts from 2nd row). Somebody please help me.

' src=

how to get this pattern using macro vb code please help me with code,thanks in advance 1 12 123 1234 12345 123456 12345 1234 123 12 1

Sub Make_No_Pyramid() Dim MaxNo Dim i As Integer, j As Integer

MaxNo = InputBox("What is the Maximum Number", "What is teh Maximum Number")

Range("A:A").ClearContents For i = 1 To MaxNo - 1 For j = i To MaxNo - 1 Cells(j, 1) = Cells(j, 1).Text & CStr(i) Cells((2 * MaxNo) - j, 1) = Cells((2 * MaxNo) - j, 1).Text & CStr(i) Next j Next i For i = 1 To MaxNo Cells(MaxNo, 1) = Cells(MaxNo, 1).Text & CStr(i) Next i Columns("A:A").HorizontalAlignment = xlLeft

' src=

My excel charts are generated when I select respective countries from a drop-down list in my data sheet. Is there a way I can incorporate this into the dashboard, i.e., create a button for country and when I select "Singapore", all charts are showing Singapore data and I can export to PPT?

Similarly, how to create the button for month? i.e., select "Jan 15" and charts is generated with Jan 15 as the last data point?

Appreciate all help/answers! 🙂

Thanks, Grace

' src=

If possible I would suggest using slicers to change the country selection and then a mcaro to control the slicer.

After I migrated to Office 2013 the code has been having trouble due to Powor Point freezing at some point while pasting charts. I've tried using Application.Wait in multiple parts of the code to allow Power Point enough time to copy and paste. However it is still crashing. Does any one have this same issue? How can I fix it?

' src=

using Drew's post in excel 2013 ... and getting error 429 the GetObject is failed line ... 'Look for existing instance On Error Resume Next Set newPowerPoint = GetObject(, "PowerPoint.Application") On Error GoTo 0

so, launched PP manually and got around the 429.

Now getting 424 error here : 'Copy the chart and paste it into the PowerPoint as a Metafile Picture cht.Select ActiveChart.ChartArea.Copy activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select

' src=

I got this to work and it is GREAT but the text boxes for the powerpoint are linked directly to certain cells in excel. Is there a way to add the text to the slides in an easier manner? I want to create a template that any user could add into an excel workbook and it would add text located next to the charts no matter how many slides there were if there is text next to the chart. Or could someone point me in the right direction or website to figure out how to do this? Thank you in advance.

@lonestardave: If you have a textbox/textframe on the slide, then the below code should work (if it is PowerPoint 2007/2010): [CODE]ActiveSlide.Shapes(2).TextFrame.TextRange.Text = "Test line 1" & vbcr & "Test line 2"[/CODE]

The number 2 in Shapes(2) can change based on the number of objects you placed in the slide. The number 1 can/will be the header of the slide and post that how many ever textboxes/frames you have. You have to check this on trial and error basis.

[CODE=VB]ActiveSlide.Shapes(2).TextFrame.TextRange.Text = "Test line 1" & vbcr & "Test line 2"[/CODE]

' src=

This has been incredibly useful, I have implemented this in many powerpoints and saved roughly 4 hours a month i reckon. I am not quite done yet though, im using excel 2003 and when i try to resize the pasted image via :

mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile Set myShapeRange = mySlide.Shapes(mySlide.Shapes.Count) 'Set position: myShapeRange.Left = 234 myShapeRange.Top = 186

, I don't get an error or anything but its just that controlling height and width don't work properly, this stops me from formatting the chart sizes. Any clue to whats going on ? solutions?

' src=

I have Office 2010 and have been integrating to TFS via Excel and subsequently generating Powerpoints through Excel for several months now, using VBA. However, i was upgraded to Project 2013 at the end of January and the integration between both TFS and Powerpoint from within Excel were broken. I found a registry key that made Excel think it was 2013 so it was looking for the wrong libraries to connect with TFS. Removing this key solved the TFS issue. However, I still have not figured out how to solve the error that prevents me from generating Powerpoints. I receive the following error

Runtime error '-2147319779 (8002801d)'

Automation error Library not registered

Any help or direction with this would be much appreciated.

Thank you, Chuck

' src=

Hi all, This is JUST what I needed and was looking for!!

However, I am getting the following -

Run-time error: '2147188160 (80048240)': Application (unknown member) : Invalid request. There is no active presentation.

What am I doing wrong?

' src=

I have managed to make use of this wonderful aspect of excel VBA.. If you still need my help I am available today...

awaiting for your response...lets do it with close interaction.. Amjad

Hi, Anybody whose query is still pending, please let me know... I have managed to make use of this wonderful aspect of excel VBA.. If you still need my help I am available today...

' src=

I want to get images in the slide rather charts what changes should I do?

' src=

I am getting the following error when I am trying to run this code

Compile Error: User Type Not Defined

Can anyone help with this?

' src=

How do I make the macro paste each chart on an specific slide?

I want to get the images rather charts in the slides. What changes should I make in the vba code?

' src=

Hi Chandoo, Can we automate alignment of data labels for any charts ?

@Chintu If you setup a chart exactly how you want it Then save that chart as a template

You can apply that template to future charts and get the same styles, layout, alignments, colors etc

' src=

I have a vba button on sheet 1 with charts on sheet 16. I want to click the button on sheet 1 to run the charts on sheet 16. Currently, you can only run the code if you are on the active sheet.

Ron (ref your post 08/17/2016),

I don't understand what "run the charts" means? Can you enlighten me please?

The code written only works if you are on that active sheet. I want to click a macro button to activate the code. A button will be placed on sheet 1 and the charts will be a sheet 16. I want people to click the button an create a powerpoint with the charts on sheet 16.

' src=

Simply change the following piece:

'Loop through each chart in the Excel worksheet and paste them into the PowerPoint For Each cht In ActiveSheet.ChartObjects

'Loop through each chart in the Excel worksheet and paste them into the PowerPoint Sheet16.Select For Each cht In Sheet16.ChartObjects

' src=

Can anybody help to figure out inserting all charts into ONE slide instead one chart per one slide?

' src=

Hi all, How to make to multiple images into multiple slides using VBA? For example, the images(jpg) and ppt file are saved in same folder. "Run macro" Image#1 is into Slide#1 Image#2 is into Slide#2 Image#3 is into Slide#3 . . . Image position and size are Left:=20, Top:=80 Width:=500, Height:=200

Can you help me please???

I want to change the path from "FileName:="C:\ ~ to current path because ppt (including images file) file path is not static.

And the images (wave_prfile and pattern.jpg) are on active slide(ppt) when run below macro.

If i want to import other images on other slides(ppt), how should i change below macro.

Please help me!

Sub InsertImage()

ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _ FileName:="C:\Temp\PPT_REPORT_MACRO\wave_profile.jpg", _ LinkToFile:=msoFalse, _ SaveWithDocument:=msoTrue, Left:=15, Top:=88, _ Width:=690, Height:=190).Select

ActiveWindow.Selection.SlideRange.Shapes.AddPicture( _ FileName:="C:\Temp\PPT_REPORT_MACRO\wave_pattern.jpg", _ LinkToFile:=msoFalse, _ SaveWithDocument:=msoTrue, Left:=15, Top:=282, _ Width:=690, Height:=220).Select

Can you please ask the question in the Chandoo.org Forums, http://forum.chandoo.org/

Please attach a sample file to simplify the response

Thanks for your comment. I already join in Chandoo.org Forums. However, I don't know how to post on the Forums.

Please let us know. Thanks a lot.

Goto the Forums and Login Select the Forum most appropriate to your question Select Post New Thread Type in a Subject/Title and complete the body of the thread Add a file is a Button at the Bottom of the thread

Thanks and Noted. Happy Christmas!

' src=

i have number of charts in an excel, i need to select by there title, is it possible

A Technique to do this is discussed here: http://chandoo.org/wp/2009/05/19/dynamic-charts-in-excel/

' src=

I have the code working almost to satisfaction currently but i'd like to be able to remove the chart title and set it as the slide title rather that have it duplicated on chart and slide. How would i go about that?

Sub CreatePowerPoint()

'First we declare the variables we will be using Dim newPowerPoint As PowerPoint.Application Dim activeSlide As PowerPoint.Slide Dim cht As Excel.ChartObject Dim DefaultTemplate As Object

'Open the default template Set DefaultTemplate = CreateObject("powerpoint.application") DefaultTemplate.Presentations.Open Filename:="C:\Users\cody.jeffries\Documents\Custom Office Templates\xxx.pptx" DefaultTemplate.Visible = True

'Let's create a new PowerPoint 'If newPowerPoint Is Nothing Then 'Set newPowerPoint = New PowerPoint.Application 'End If

'Make a presentation in PowerPoint 'If newPowerPoint.Presentations.Count = 0 Then 'newPowerPoint.Presentations.Add 'End If

'Show the PowerPoint 'newPowerPoint.Visible = True

'Add a new slide where we will paste the chart newPowerPoint.ActivePresentation.Slides.Add newPowerPoint.ActivePresentation.Slides.Count + 1, ppLayoutTitleOnly newPowerPoint.ActiveWindow.View.GotoSlide newPowerPoint.ActivePresentation.Slides.Count Set activeSlide = newPowerPoint.ActivePresentation.Slides(newPowerPoint.ActivePresentation.Slides.Count)

'Copy the chart and paste it into the PowerPoint as a Metafile Picture cht.Select ActiveChart.ChartArea.Copy activeSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select

'Set the title of the slide the same as the title of the chart 'activeSlide.Shapes(1).TextFrame.TextRange.Text = cht.Chart.ChartTitle.Text

'Adjust the positioning of the Chart on Powerpoint Slide 'newPowerPoint.ActiveWindow.Selection.ShapeRange.Left = 25 activeSlide.Shapes(2).Width = 800 'activeSlide.Shapes(3).Left = 505 newPowerPoint.ActiveWindow.Selection.ShapeRange.Align msoAlignCenters, True newPowerPoint.ActiveWindow.Selection.ShapeRange.Align msoAlignMiddles, True newPowerPoint.ActiveWindow.Selection.ShapeRange.Top = 90

Set activeSlide = Nothing Set newPowerPoint = Nothing

' src=

How can I amend this code so that it points to a specific worksheet to be exported, rather than just the active sheet?

I want to create a dashboard on a separate worksheet with an "export to PowerPoint" button at present the macro requires the exact worksheet to be selected...

Many thanks

' src=

Hi all, Is there anyway of modifying the example worksheet code so that it captures print ranges from different worksheets instead of having to list each line you want captured manually.

If the code variation that allows you to say import to slide 1 or slide 2 can also be shared then that would be appreciated.

I'm also not looking to export graphs just text entries so if the code can be simplified as a result then even better.

Thanks in advance for any help.

' src=

Hi, is there a way to combine pivot charts from multiple workbooks into one sheet and then automatically create a powerpoint from it? Or let's just say that I have pivot table in different workbook and I want to combine them all to make one powerpoint presentation. Any help will be greatly appreciated. Thanks!

' src=

Hi, probably. I would start with using EXCEL PowerQuery to combine the pivot charts from multiple workbooks into one sheet.

' src=

Is there any way to simplify VBA programming?

What I'd like to do is create a powerpoint macro that re-creates a slide graphic (rather than copy-pasting it from a previous presentation). Instead of programming each individual part of the slide graphic, can I "apply" the formatting of one slide to another slide? I'm thinking there must be a way for me to reference another slide in creating a new slide...

' src=

I realize this is an old post, but I'm hoping someone can still help me.

I am using Excel and PowerPoint 2016 -64 bit

I have used this code with tweeks to size and position the charts. Everything works great on my computer. When I switch to another computer using the exact same Excel and PowerPoint versions, the charts are sized and positioned differently. I opened the PowerPoint presentation made from the second computer on my computer and the charts are the same wrong size in which they were created. I leave that presentation open, run the macro from excel and the charts size correctly.

Any ideas would be greatly appreciated.

Hi, I would start by comparing the Advanced System settings for Performance for each computer then compare the graphic 'card' and monitor settings. The problem sounds similar to HTML scripting where the positioning can be coded relative to the display environment.

Hi Drew, Thank you for publishing this undocumented "slides.add" method. Makes you wonder how many other undocumented features there are. Kind of like the 'easter eggs' of old. Thanks again.

' src=

Your code was very helpful. Just wanted to know if it's possible to create a ppt with a predefined template and not just plain white slides. I have my own template, if you can share the sample code that would be great.

' src=

Is there a workaround to the error DavidLim commented on 8/2011 "however, if a chart (or combo grouped-charts) is large, the VBA will not run.

error box: “Run-time error -2147418113 (8000ffff)’: Method ‘Copy’ of object ‘ChartArea’ failed”"

I'm having this problem. Wonder if it's because the chart I'm trying to export was created in Excel 2007 (Zimmerman in 2010 now). Code works fine with brand new chart.

Couple of other questions: - is there a way to 'set focus' on the pasted chart to do something like resize so I don't have to figure out which shape number it is (ex. know that it is the 3rd shape and then use shape(3).top) - how can u name a chart and then ref in code regardless on what sheet it's on

' src=

"how can u name a chart and then ref in code regardless on what sheet it's on" This macro will name the selected shape: Sub NAMEIT() ActiveWindow.Selection.ShapeRange(1).Name = "Shape_name_1" End Sub

This will loop through each slide and check for that shape name: Set opres = Presentations.Open(fxname, False, False, True) opres.Windows(1).Activate

'Looping through each slide

For i = 1 To opres.Slides.Count 'ActivePresentation.Slides.Count For Each oSH In opres.Slides(i).Shapes

If oSH.Name =

For i = 1 To opres.Slides.Count 'ActivePresentation.Slides.Count For Each oSH In opres.Slides(i).Shapes If oSH.Name = "Shape_name_1" then 'Do whatever you need to the shape. end if Next Next i

' src=

Great help! Thanks!

[…] http://chandoo.org/wp/2011/08/03/create-powerpoint-presentations-using-excel-vba/ […]

' src=

The code presented in this tutorial is great. Was able to adapt to exporting Excel ranges in no time. Thanks for getting this out there!

' src=

Id like to do this same concept but instead of charts, I'd like pictures and next to it words.

Any thoughts?

[…] Create PowerPoint Presentations Automatically using. – You've been there before. It's almost 5:00, and you are going crazy trying to finish the presentation due for a monthly performance meeting the next morning. […]

[…] here is some extra help on Automating Powerpoint with VBA and […]

' src=

This is awesome. My question is once this ppt is created how can I save this in user desktop/ drives and then next time if my excel is refreshed , macro only refreshes the ppt rather that creating a new one again

' src=

Thank you so much Drew for writing this insightful article. Being a PowerPoint template designer, VBA is not my thing, but your step by step instructions made it easy to work. Thank again!

Sam @ Slidehelper

' src=

I am trying to get this code working with Microsoft Excel 2016. I have updated the reference to new PPT object Library. The code creates a powerpoint but, crashes at AppActivate ("Microsoft PowerPoint") in Sub BuildPPT().

' src=

I would like to create a PPT, possibly just one slide where a block of text can slowly be changed one character at a time under the control of a VBA program. Sometimes a character is inserted and sometimes one character is replaced by another. Is this something I can do with VBA and PPT?

' src=

Thanks Drew. This article is old but interesting nonetheless. Having the ability to create PowerPoint presentation automatically using VBA has saved us countless hours in manually creating slides for frequently updated reports and dashboards.

' src=

Hi Chandoo, really love this VBA code you did 🙂

I need to create something similar like the example at the bottom: https://www.presentationpoint.com/blog/automating-powerpoint-from-excel/

Am wondering if you have a VBA for this, because the above link is a paid plug in, and i am just an intern trying to impress my boss hahaha

' src=

Great job here...What is frustrating to me is that there is no way, as far as I know, to do the same with Word documents. Word has so many options (forms, etc.) and it seems that one should be able to do the same with Word. I know that Word headings can be automatically converted but not images, forms, etc. (as far as I know). Is anyone aware of any VBA routine that will allow us folks that like to use Word in document generation to do a similar thing that has been demonstrated here???? Thanks!!!

@York Have a read of : https://social.msdn.microsoft.com/Forums/office/en-US/aa1ae70a-4a70-467f-afea-318de2281f71/using-vba-to-capture-word-documents-and-paste-to-powerpoint?forum=officegeneral

' src=

Why you just don't create the image linked with you excel table?. So any changes in the excel table will make the powerpoint chart update.

' src=

Please make a VB script in excel paid basis

' src=

Really Helpful content Chandoo, I also have some of excel tools developed at my end. Can be really helpful for data analysts and process engineers. Please let me know how can I contribute my bit.

' src=

Thanks Drew!

' src=

No sé como resolver en powerpoint error en presentación Application (unknown member): Invalid request. There is no currently active document window. desde un boton en una diapositiva quiero que vaya a la diapositiva 2 y abra formulario.

Sub acceso_inicial_Click()

Application.ActiveWindow.View.GotoSlide 2

UserForm1.Show End Sub

Leave a Reply

Name (required)

Mail (will not be published) (required)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Notify me of when new comments are posted via e-mail

Get FREE Excel & Power-BI Newsletter

One email per week with Excel and Power BI goodness. Join 100,000+ others and get it free. 

Get Started

  • Excel Basics
  • Advanced Excel
  • 100+ Formulas
  • Free Crash Course
  • Pivot Tables

Online Classes

  • Excel School
  • VBA Classes
  • Power BI Classes
  • 50 ways to analyze data
  • Mini Courses
  • Welcome Message
  • Forum & Community
  • 20+ Excel Templates
  • 200+ Dashboards
  • 40+ VBA Code samples
  • Ebooks & More

© All rights reserved.

Software Solutions Online

VBA and VB.Net Tutorials, Education and Programming Services

How to use vba to add text to powerpoint slides.

This article explains how you can add text to PowerPoint slides using VBA.

Note unlike MS Word where you can add text anywhere in the document, in PowerPoint you can only add text inside text boxes. This is regardless of whether you are using VBA or you are trying to manually input text. So the first thing we need is a text box. Most slide templates come with preset text boxes. Although there are a few that don’t have any text boxes at all. In this article I will assume that there is already a textbox available in the slide and we will fill the textbox with text.

Textboxes

The code below will return a reference to the slide object:

Textboxes, pictures, smartart, video files, … they are all considered shapes in the slide. We have 2 textboxes in the selected slide, therefore there will be 2 shape objects in the slide. We can get reference to the textbox object using the code below:

In order to write text in the textbox we can use the code below:

You’ll note that we make use of TextFrame, which you can learn more about here .

Result

2 thoughts on “How to Use VBA to Add Text To PowerPoint Slides”

Leave a reply cancel reply.

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

VEGA SLIDE

How to Open and Use VBA Macro Editor in PowerPoint

powerpoint vba presentations add

Are you tired of manually performing repetitive tasks in PowerPoint? Look no further than the open VBA Macro editor in PowerPoint 2021. Whether you’re a seasoned PowerPoint user or just getting started, understanding how to use the VBA Macro editor can drastically improve your workflow.

Table of Contents

What is vba.

VBA stands for Visual Basic for Applications. It is a programming language that is used to extend the functionality of Microsoft Office applications like Excel, Word, and PowerPoint.

A VBA macro is a piece of code written in VBA that performs a series of tasks or commands in a Microsoft application. They can automate repetitive and complex tasks to save time and manual work. So, VBA is the language used to write macros, while macros are the code that is written using VBA.

Steps to open the VBA macro editor

1. Create a new presentation or open an existing one. Then go to the File tab and click on Options .

powerpoint vba presentations add

2. Click on Customize Ribbon , and check the box next to Developer and click OK .

powerpoint vba presentations add

3. Go to the Developer tab and click on Visual Basic . Another way is to press Alt + F11 on your keyboard. This will open the VBA Macro editor in a separate window.

powerpoint vba presentations add

4. In the VBA Macro editor, you can see the Project Explorer pane on the left, which shows all the modules and objects in your presentation. You can also see the Code window on the right, where you can write and edit your VBA code.

powerpoint vba presentations add

5. To create a new module, go to the Insert menu and click on Module .

powerpoint vba presentations add

6. A new module will appear in the Project Explorer pane with a default name like Module1 .

powerpoint vba presentations add

7. To create a new macro, type Sub followed by a name for your macro in the Code window. For example, Sub HelloWorld() . Then press Enter and type End Sub on a new line. This will create a basic macro structure with a name and an empty body.

powerpoint vba presentations add

8. To write your VBA code, type it between Sub and End Sub lines. For example, to make a message box pop up with the text “Hello World”, type MsgBox “Hello World” on a new line.

powerpoint vba presentations add

9. To run your macro, go to the Run menu and click on Run Sub/UserForm or press F5 .  

powerpoint vba presentations add

10. You should see a message box with the text “Hello World” appear on your screen.

powerpoint vba presentations add

You have successfully opened the VBA Macro editor in PowerPoint 2021 and created your first macro. You can now explore more VBA features and functions and create more complex and powerful macros for your presentations.

How do I open the VBA editor in PowerPoint?

The quickest way to open the VBA editor in PowerPoint is by pressing Alt+F11 . Laptop users may need to combine it with Fn .

You may also enable the Developer tab. Go to Developer > Macros . Select the macro and click Run .

How do I edit VBA code in PowerPoint?

Open the VBA editor by pressing Alt+F11 . Select the macro in the Macros dialog box and click Edit . This opens the code for editing.

How do I create a new VBA module in PowerPoint?

powerpoint vba presentations add

To create a new VBA module in PowerPoint, first open the VBA editor by pressing ALT+F11 . Once the VBA editor is open, insert a new module by going to Insert > Module . This will insert a blank code module. This allows you to automate tasks and add functionality in PowerPoint using VBA programming.

How can I assign a keyboard shortcut to run a macro in PowerPoint?

To assign a keyboard shortcut to a macro in PowerPoint, first create the macro and write the VBA code. Then go to the File > Options > Customize Ribbon . In the box on the left, select Macros . Then select the macro you want to assign a shortcut to from the list on the right.

Click the Add button to add it to the customizable shortcuts. Click the Modify button. In the Modify Button dialog box, enter the keyboard shortcut you want to assign in the Press new shortcut key box (e.g. “^+G” for Ctrl+Shift+G). Click Assign , then OK . Now you can quickly execute the macro by pressing the keyboard shortcut instead of going through the ribbons.

How can I debug VBA code in the PowerPoint editor?

I find the easiest way to debug VBA code in PowerPoint is to use the built-in debugging tools.

First, I open the Visual Basic editor by pressing Alt+F11 . Then I set breakpoints in my code by clicking in the left margin of the line numbers. When I run the code with F5 , it will pause execution at any breakpoint I set so I can step through my code line-by-line with F8 and inspect variables.

I also use the Immediate window (Ctrl+G) and Debug.Print statements to output variable values. With these tools, I can methodically walk through my code to identify and fix any issues.

About The Author

Rully novrianto, related posts.

powerpoint vba presentations add

How to Stop Compressing Images in PowerPoint 2013

powerpoint vba presentations add

PowerPoint vs. Keynote vs. Google Slides: Which One to Choose

powerpoint vba presentations add

How to Convert Google Slides to PowerPoint and Vice-Versa

powerpoint vba presentations add

How to Create a Slide Master in Microsoft PowerPoint

How To View PowerPoint Add-in VBA Code Inside Visual Basic Editor

How To View PowerPoint Add-in VBA Code Inside Visual Basic Editor

Where Did My Code Go?

That was the question I was asking myself when I first began to create PowerPoint add-ins for my own personal use.  With much research, I came to the realization that PowerPoint doesn't like to show VBA code associated with presentation files that are of the add-in format. Luckily I was able to find a very simple workaround to this problem that will at least let you view your add-in code in real-time while in PowerPoint.

I found these steps through Shyam Pillai's PowerPoint MVP website and I want to thank him for sharing this and a bunch of other great PowerPoint tips on his site.

Modifying Your Registry

  • Close down PowerPoint
  • Go to your Start Menu and find your Run  application (the easiest way is to type 'Run' in your search box)
  • Type in Regedit.exe and click OK
  • Navigate to the following key in the registry tree*:  HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\PowerPoint\Options
  • Find the key name DebugAddins .  If you do not see it you will need to create it (steps for this are shown in the next section)
  • Double click on DebugAddins and in the window that pops up ensure the DWORD value is 1 and click OK
  • Launch PowerPoint and go into your Visual Basic Editor (Alt+F11).  You will now be able to see any PowerPoint add-in VBA code that is currently running

*Note that the 15.0 may be a different number based on the Office version you are running (12.0 is Office 2007, 14.0 is Office 2010)

iew Microsoft PowerPoint Add-in VBA macro code - Modify Registry Steps

How To Create the DebugAddins Key

More than likely you are not going to have the DebugAddins key created in your Options folder, so you are going to have to create one. Make sure immediately after you create the new DWORD value that you rename it DebugAddins .  Once the name is set there is no way to modify it (if have the wrong name, just right-click on the name and delete the line item, then start over).  Below are the steps you will need to take to create your registry key.

iew Microsoft PowerPoint Add-in VBA macro code - Modify Registry Steps

And You’re Done Messing With The Registry!

Confirm that you have the proper name, type, and data values in your line item and you are done!  Now you can start up your PowerPoint application and you will be able to see your VBA add-in projects inside the PowerPoint Visual Basic Editor.  Note you will not be able to save changes made to the add-in code.  If you need to make changes you will either have to modify your original PowerPoint Macro-enabled file that you used to create the add-in or you can make a new PowerPoint project and save it as a new add-in file.

iew Microsoft PowerPoint Add-in VBA macro code - Modify Registry Steps

After 10+ years of creating macros and developing add-ins, I've compiled all the hacks I wish I had known years ago!

Hidden Hacks For VBA Macro Coding

Keep Learning

How To Use VBA Code With Oracle's Smart View Add-in

How To Use VBA Code With Oracle's Smart View Add-in

What Is The Oracle Smart View Add-in? The Smart View Excel Add-in is a free Oracle tool that allows you...

How To Show The Developer Ribbon Tab [With Pictures]

How To Show The Developer Ribbon Tab [With Pictures]

Steps To Add The Developer Tab In Excel For PCAdd The Developer Tab in Microsoft WordAdd The Developer Tab in...

Excel QAT Setups From Some Of The Excel Community's Finest

Excel QAT Setups From Some Of The Excel Community's Finest

What's a QAT? QAT is short for Quick Access Toolbar and this bar is typically setup to store frequently used Excel functionalities;...

Chris Newman

Chris Newman

Chris is a finance professional and Excel MVP recognized by Microsoft since 2016. With his expertise, he founded TheSpreadsheetGuru blog to help fellow Excel users, where he shares his vast creative solutions & expertise. In addition, he has developed over 7 widely-used Excel Add-ins that have been embraced by individuals and companies worldwide.

powerpoint vba presentations add

February 2024 updates for Microsoft Office

Introduction.

Microsoft released the following security and nonsecurity updates for Office in February 2024. These updates are intended to help our customers keep their computers up to date. We recommend that you install all updates that apply to you.

To download an update, select the corresponding Knowledge Base article in the following list, and then go to the "How to download and install the update" section of the article.

List of Office updates released in February 2024

Microsoft office 2016, sharepoint server subscription edition, microsoft sharepoint server 2019.

Facebook

Need more help?

Want more options.

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

powerpoint vba presentations add

Microsoft 365 subscription benefits

powerpoint vba presentations add

Microsoft 365 training

powerpoint vba presentations add

Microsoft security

powerpoint vba presentations add

Accessibility center

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

powerpoint vba presentations add

Ask the Microsoft Community

powerpoint vba presentations add

Microsoft Tech Community

powerpoint vba presentations add

Windows Insiders

Microsoft 365 Insiders

Was this information helpful?

Thank you for your feedback.

このブラウザーはサポートされなくなりました。

Microsoft Edge にアップグレードすると、最新の機能、セキュリティ更新プログラム、およびテクニカル サポートを利用できます。

Presentations.Add メソッド (PowerPoint)

プレゼンテーションを作成します。 新しいプレゼンテーションを表す Presentation オブジェクトを返します。

式 。 Add ( WithWindow )

式 Presentations オブジェクトを表す変数。

Presentation

WithWindow パラメーターの値に使用できるのは、次に示す MsoTriState クラスの定数のいずれかです。

次の使用例は、プレゼンテーションを作成し、このプレゼンテーションにスライドを追加し保存します。

プレゼンテーション オブジェクト

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、 Office VBA のサポートおよびフィードバック を参照してください。

このページはお役に立ちましたか?

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 .

フィードバックの送信と表示

IMAGES

  1. How to use VBA in PowerPoint: A beginner's guide

    powerpoint vba presentations add

  2. VBA PowerPoint

    powerpoint vba presentations add

  3. How to use VBA in PowerPoint: A beginner's guide

    powerpoint vba presentations add

  4. How to use VBA in PowerPoint: A beginner's guide

    powerpoint vba presentations add

  5. VBA PowerPoint

    powerpoint vba presentations add

  6. How to use VBA in PowerPoint: A beginner's guide

    powerpoint vba presentations add

VIDEO

  1. PowerPoint_VBA 도형정렬

  2. PowerPoint_VBA Component 불러오기

  3. Powerful Presentations in Minutes: ChatGPT + VBA Quick Tips!

  4. Powerpoint VBA : การสร้างแบบทดสอบที่เก็บคะแนนลงฐานข้อมูล

  5. PowerPoint_VBA 도형과 도형을 화살표로 연결

  6. POWERPOINT VBA TO START ANIMATION ON KEY PRESS

COMMENTS

  1. Presentations.Add method (PowerPoint)

    With Presentations.Add .Slides.Add Index:=1, Layout:=ppLayoutTitle .SaveAs "Sample" End With See also. Presentations 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.

  2. Slides.AddSlide method (PowerPoint)

    VBA Slides.AddSlide method (PowerPoint) Article 09/12/2021 7 contributors Feedback In this article Syntax Parameters Return value Example Show 2 more Creates a new slide, adds it to the Slides collection, and returns the slide. Syntax expression. AddSlide ( _Index_, _pCustomLayout_ ) expression An expression that returns a Slides object. Parameters

  3. in VBA powerpoint How to add a new slide to an empty presentation

    1 You can simply use something like this : ActivePresentation.Slides.Add Index:=ActivePresentation.Slides.Count + 1, Layout:=ppLayoutCustom With that you don't have to get the layout from elsewhere and you can change it, see some of the other possiblities that you have on screenshot : Share

  4. VBA Macro to create Powerpoint presentation and add slides

    VBA to Create PowerPoint Presentation In the VB Editor, right click on VBAProject and hit Insert. Select Module. Paste the following code in the newly create module. Sub CreatePresentation () Dim NewPres as Presentation Set NewPres = Presentations.Add NewPres.SaveAs ("MyPresentation.pptx") End Sub Hit File and then Save.

  5. How to use VBA in PowerPoint: A beginner's guide

    PowerPoint VBA provides you with a way to do one of two things using macros and add-ins: Automate PowerPoint: If you ever find yourself repeating the same task over and over again, VBA could be your new best friend. Let's say you have 100 slides and you need to unhide all hidden objects across all those slides.

  6. PowerPoint VBA Macro Examples & Tutorial

    Go to a Specific Slide Move 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 Useful PowerPoint Macro Examples

  7. Presentations object (PowerPoint)

    01/19/2022 7 contributors Feedback A collection of all the Presentation objects in Microsoft PowerPoint. Each Presentation object represents a presentation that's currently open in PowerPoint. Remarks The Presentations collection doesn't include open add-ins, which are a special kind of hidden presentation.

  8. Create PowerPoint Presentations Automatically using VBA

    1. Build your charts in Excel 2. Create a new worksheet and paste in all the charts you need for the presentation. 3. Open VBA. To do this, you can either press ALT + F11, or you can take the following steps: a. To show the developer tab, click on the Microsoft Office Button and click Excel Options. b.

  9. Working with PowerPoint in Excel VBA

    Here is how to link PowerPoint to Excel: 1. In the VBA Editor, click on Tools | References. The References — VBAProject dialog box will open: Figure 18.1 — The References — VBAProject dialog box. 2. Scroll down the list of available references until you find Microsoft PowerPoint 16.0 Object Library:

  10. Create PowerPoint Presentation From Excel Using VBA

    To get a new module, go to Insert menu and select a Module option as shown below. Step 4: In that module write the subcategory of VBA PowerPoint or in any other name as per your need as shown below. Code: Sub VBA_Presentation () End Sub Step 5: Now for creating a presentation with the help of Chart in excel, we need few Variables.

  11. VBA Tutorial to Create Powerpoint Presentation

    Step 8: We need to add a presentation to the PowerPoint app we have launched. Code: PPPresentation = PPApp.Presentations.Add. Now, we should see the PowerPoint presentation like this. Step 9: We need to add a slide after adding the presentation. Code: PPSlide = PPPresentation.Slides.Add (1, ppLayoutTitleOnly)

  12. PowerPoint VBA Macros and Coding Interactive Presentations

    Inserting controls, shapes, images and audio into PowerPoint slides and adding related macro actions. VBA macro coding concepts related to PowerPoint from complete beginner to more advanced topics. Create custom interactive slide presentations through VBA code. Create a complete project to produce a macro-driven utility with full user interface.

  13. How to Use VBA to Add Text To PowerPoint Slides

    This article explains how you can add text to PowerPoint slides using VBA. Note unlike MS Word where you can add text anywhere in the document, in PowerPoint you can only add text inside text boxes. This is regardless of whether you are using VBA or you are trying to manually input text. So the first thing we need is a text box. Most slide ...

  14. Presentation object (PowerPoint)

    VB ActivePresentation.Save Use the Presentation property to return the presentation that's in the specified document window or slide show window. The following example displays the name of the slide show running in slide show window one. VB MsgBox SlideShowWindows (1).Presentation.Name Methods Expand table Name

  15. How to Open and Use VBA Macro Editor in PowerPoint

    1. Create a new presentation or open an existing one. Then go to the File tab and click on Options. 2. Click on Customize Ribbon, and check the box next to Developer and click OK. 3. Go to the Developer tab and click on Visual Basic. Another way is to press Alt + F11 on your keyboard. This will open the VBA Macro editor in a separate window. 4.

  16. How To View PowerPoint Add-in VBA Code Inside Visual Basic Editor

    If you do not see it you will need to create it (steps for this are shown in the next section) Double click on DebugAddins and in the window that pops up ensure the DWORD value is 1 and click OK. Launch PowerPoint and go into your Visual Basic Editor (Alt+F11). You will now be able to see any PowerPoint add-in VBA code that is currently running.

  17. SectionProperties.AddBeforeSlide method (PowerPoint)

    The indices of sections after the newly inserted section are automatically incremented by one. If a section break exists immediately before the specified slide index, the new section is placed after the section break, with the result that the preceding section is now empty, and the specified slide index is now the first slide of the new section.

  18. Creating PowerPoint Add-Ins from VBA defined Macros

    Exit VBA, and save the Presentation as a .ppam. Under the Developer Tab, click on the "PowerPoint Add-ins" button. Click the "Add New..." option, and browse for your recently created .ppam file. Click Load. Click Close. Click Add-ins. You should now see your new Add-in. I have done everything mentioned above and can even see the new Add-in when ...

  19. February 2024 updates for Microsoft Office

    Microsoft released the following security and nonsecurity updates for Office in February 2024. These updates are intended to help our customers keep their computers up to date. We recommend that you install all updates that apply to you. To download an update, select the corresponding Knowledge Base article in the following list, and then go to ...

  20. Presentations.Add メソッド (PowerPoint)

    構文 パラメーター 戻り値 注釈 プレゼンテーションを作成します。 新しいプレゼンテーションを表す Presentation オブジェクトを返します。 構文 式 。 Add ( WithWindow) 式 Presentations オブジェクトを表す変数。 パラメーター テーブルを展開する 戻り値 Presentation 注釈 WithWindow パラメーターの値に使用できるのは、次に示す MsoTriState クラスの定数のいずれかです。 テーブルを展開する 例 次の使用例は、プレゼンテーションを作成し、このプレゼンテーションにスライドを追加し保存します。 VB

  21. Apply template to powerpoint in Excel VBA from embedded template file

    1 I'm trying to apply a template to a powerpoint through excel. The powerpoint template is embedded within my excel file via insert -> Object. I've successfully used the .applytemplate method to apply a template from file, but I cannot adjust the code to reference the embedded powerpoint template.

  22. Protecting VBA based PowerPoint add-in

    Password protect will only protect people from accessing the macro codes, but won't stop them from using the tool. I tried to place a module code along with other add-in codes which checks for a dummy file in a particular location, and only then it can open the add in for use. But somehow it by passes this step and allows user to access the ...