+ Reply to Thread
Results 1 to 14 of 14

Add new slide to Powerpoint

Hybrid View

rpinxt Add new slide to Powerpoint 05-08-2017, 06:45 AM
Sintek Re: Add new slide to... 05-08-2017, 06:55 AM
rpinxt Re: Add new slide to... 05-08-2017, 07:05 AM
xlnitwit Re: Add new slide to... 05-08-2017, 07:13 AM
rpinxt Re: Add new slide to... 05-08-2017, 07:17 AM
xlnitwit Re: Add new slide to... 05-08-2017, 07:20 AM
rpinxt Re: Add new slide to... 05-08-2017, 07:23 AM
xlnitwit Re: Add new slide to... 05-08-2017, 07:32 AM
rpinxt Re: Add new slide to... 05-08-2017, 07:58 AM
rpinxt Re: Add new slide to... 05-08-2017, 08:29 AM
xlnitwit Re: Add new slide to... 05-08-2017, 08:34 AM
rpinxt Re: Add new slide to... 05-08-2017, 08:42 AM
xlnitwit Re: Add new slide to... 05-08-2017, 09:29 AM
rpinxt Re: Add new slide to... 05-08-2017, 09:30 AM
  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Add new slide to Powerpoint

    Tried several different way I could find online, but they all give me excel error messages....
    (Mostly argument is not optional)

    This is the code :
    Sub Open_PowerPoint_Presentation()
    
    Dim objPPT As Object, _
        PPTPrez As PowerPoint.Presentation, _
        pSlide As PowerPoint.Slide, _
        pptLayout As CustomLayout
    
    Set objPPT = CreateObject("PowerPoint.Application")
    objPPT.Visible = True
    
    Set PPTPrez = objPPT.Presentations.Open("H:\TEMP\PPT\Template\OpenATemplate.pptx")
    Set pSlide = PPTPrez.Slides(1)
    
    
        'Charts
        Sheet9.Visible = xlSheetVisible
        Sheet9.Select
        Sheet9.Shapes.Range(Array("Picture 2")).Select
        Selection.Copy
        pSlide.Shapes(6).Select
        pSlide.Shapes.PasteSpecial(DataType:=ppPasteMetafilePicture).Select
        Application.CutCopyMode = xlCut
     
    End Sub
    So after the chart has been pasted (this all works just fine) I simply want to add a new Slide.
    How hard can it be you would think....

  2. #2
    Forum Guru Sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2019 | 2021
    Posts
    14,958

    Re: Add new slide to Powerpoint

    Hi rpinxt

    Have a look here:
    https://www.experts-exchange.com/que...sentation.html
    http://peltiertech.com/Excel/XL_PPT.html
    Good Luck...
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the [★ Add Reputation] to left of post window...
    Also....Add a comment if you like!!!!
    And remember...Mark Thread as Solved...
    Excel Forum Rocks!!!

  3. #3
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: Add new slide to Powerpoint

    Hmm thanks sintek, but now I am getting error like 'Object required'.

    Can it really be that hard to add 1 extra slide to an existing and open powerpoint presentation?

  4. #4
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Add new slide to Powerpoint

    Hi,

    You might add this
    Set pptLayout = pSlide.CustomLayout
     PPTPrez.Slides.AddSlide PPTPrez.Slides.Count + 1, pptLayout
    or alternatively you could just duplicate another slide.
    Last edited by xlnitwit; 05-08-2017 at 07:19 AM.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  5. #5
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: Add new slide to Powerpoint

    Thanks xlnitwit.
    Was a small typo in that last line (ppTlayout), but even this gives me the object required error on that last line...

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Add new slide to Powerpoint

    Apologies- I just corrected that. It works in PP2010.

  7. #7
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: Add new slide to Powerpoint

    Hmmm since a few weeks I work in Office 365 so I think that is Excel 2016.
    But why would it throw me an object required error?

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Add new slide to Powerpoint

    Did you correct that last line to use pptLayout or pptLayoutBlank? It should be the former.

  9. #9
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: Add new slide to Powerpoint

    Ahh...thought you corrected ppt, but you also took out blank.

    This works just fine!
    Thanks.

  10. #10
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: Add new slide to Powerpoint

    Ok wait I still like to know somehting...better use this thread.

    How would I now select that new slide....I again get the object required and active x error messages.....

  11. #11
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Add new slide to Powerpoint

    Generally selecting is not necessary but
    PPTPrez.Slides.AddSlide(PPTPrez.Slides.Count + 1, pptLayout).Select
    should be sufficient.

  12. #12
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: Add new slide to Powerpoint

    Ok thanks that did it.

    But what you mean with is not necessary?

    How would I paste my next chart to the shape(6) on the new added sheet then without selecting that sheet?

  13. #13
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Add new slide to Powerpoint

    Using similar code to the previous one where you pasted using the slide object directly
    pSlide.Shapes.PasteSpecial DataType:=ppPasteMetafilePicture
    You do not need to select pSlide before running that line.

  14. #14
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: Add new slide to Powerpoint

    Ok thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. PowerPoint Slide simulates a Screensaver?
    By DeeDawg in forum PowerPoint Formatting & General
    Replies: 2
    Last Post: 04-21-2016, 03:14 AM
  2. [SOLVED] Add slide in Powerpoint via Excel
    By benishiryo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2015, 06:24 AM
  3. Excel 2007 VBA code to close powerpoint slide show, but not powerpoint application
    By christopher@groth.cc in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-18-2015, 06:39 AM
  4. importing PDF into powerpoint slide
    By OliverBrain in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-04-2015, 10:25 AM
  5. Linking to specific powerpoint slide
    By Jdaly in forum Excel General
    Replies: 1
    Last Post: 01-17-2014, 12:28 PM
  6. Insert images in a pre-powerpoint slide
    By PRADEEPB270 in forum PowerPoint Formatting & General
    Replies: 2
    Last Post: 01-08-2014, 05:39 AM
  7. Adding a Powerpoint slide using Excel vba
    By db1966 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-25-2008, 12:07 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1