How To Paste Multiple Objects To A Slide in VBA

Поділитися
Вставка
  • Опубліковано 16 жов 2024

КОМЕНТАРІ • 25

  • @donballesteros1744
    @donballesteros1744 4 роки тому +1

    Hi. This is a great help. I do have a need to (1) use my own ppt template with some logos (2) transfer all charts in an excel workbook and paste it in specifical slide pages while (3) positioning each of those objects/charts in the targetted slides. You were mentioning this in your video and was hoping you that solution also. MANY THANKS!!!!

  • @rfrost8551
    @rfrost8551 4 роки тому

    Thanks. I've watched quite a few of the other links now and its making some sense. If you could do an example where the objects, tables, charts, their dimensions, their intended slide number and positioning is stored in a table then JACKPOT, i get some years of my life back. Thanks again for the excellent examples you've walked through. THANKS :)!!

  • @santoshvutukuri8855
    @santoshvutukuri8855 4 роки тому +1

    Awesome and It helped me to put a structure to my approach

    • @SigmaCoding
      @SigmaCoding  4 роки тому

      Wonderful, that's the goal give enough info just to make some dangerous! ;)

  • @darkstar218
    @darkstar218 2 роки тому

    Hi, thank you for these videos. Wish I knew about them 3 years ago. When you are defining the dimensions array, how do you get those measurements you wrote down?

  • @meenakshisundaramthambusam7499
    @meenakshisundaramthambusam7499 2 роки тому

    ObjArray = Array(Sheet1.Range("B2:D5"), Sheet1.ChartObjects(1), Sheet1.ListObjects(1))

  • @studentstudent1393
    @studentstudent1393 2 роки тому

    How do u take an array of sheet data from excel to ppt as an object paste, and have it autofit the slide in standered size, formatting maximum fit?

  • @yitao_
    @yitao_ 3 роки тому

    Thanks! How do I select different columns from a sheet and paste them to a slide as one sheet in stead of two separate ranges?

  • @stacycereceres
    @stacycereceres 5 років тому +1

    Hi. At the end of your video you mentioned that you were going to make a video where you could go through multiple worksheets and copy charts/ranges/etc. I was looking through the videos but I don't think I've seen anything like this. Have you made one like this? I can make 2 ppt slides but it doesn't copy anything over.

    • @SigmaCoding
      @SigmaCoding  5 років тому +1

      Yes, I cover how to copy all sorts of objects over to PowerPoint! Here is a link to the playlist.
      *ua-cam.com/play/PLcFcktZ0wnNlFcSydYb8bI1AclQ4I38VN.html*
      That was actually the first topic I ever covered on the channel, so its bury deep inside the video list.

  • @shueybamin5244
    @shueybamin5244 3 роки тому

    Hi, this is great, however after playing around with this, I'm getting stuck. After running it first time to create a PowerPoint Presentation as per this code, how do I then add it to the next slide if I were to run the code again?

  • @bjiuann
    @bjiuann Рік тому

    1) How to export Group chart?
    2) I have about 4 group charts with respective table in one sheet and I have them in multiple sheets. How to combine this "Paste Multiple Objects To A Slide in VBA" with "Exporting Multiple Excel Charts To PowerPoint Using VBA"?
    Thank you.

  • @MrKanakou
    @MrKanakou 2 роки тому

    at the end of creating the pptx presentation, it appears there is no way (in the script) to save it. It appears that "this application" refers to the excel vba script - and cannot be switched to point to the pptx presentation.......... is that right? (needless to say, one just hops over to the open pptx presentation and saves it manually, . . . . but it seems more cool to put that into the script, no?

  • @michaeljohnston9713
    @michaeljohnston9713 3 роки тому +1

    What if your object you want to grab is a pivot tabe? How would you list that in the ObjArray and copy area of the code?

    • @SigmaCoding
      @SigmaCoding  3 роки тому

      I have a video about copying Pivot Tables to Outlook. That should get you in the right direction: ua-cam.com/video/JjbvTngTr-M/v-deo.html

  • @Nahidchy91
    @Nahidchy91 3 роки тому

    Hi I'm able to copy paste the shapes in specific Slide however I want to change the dimension of a specific shapes in a specific slide so help me on this.
    Thanks.

  • @michaeljohnston9713
    @michaeljohnston9713 3 роки тому +1

    What if you had an existing PPT with objects. I have figured out how to open the existing PPT (not sure if New before PowerPoint. Application was the correct syntax but it worked).
    'Open Instance of PowerPoint
    Set PPTApp = New PowerPoint.Application
    PPTApp.Visible = True
    PPTApp.Presentations.Open "C:\Users\mjohnston\Desktop\Presentation1.pptx"
    PPTApp.Activate
    However, how do you delete all objects on that slide before pasting new ones? I keep receiving "activex component can't create object" when looking at other online sources for deleting objects.
    The PPT will be approximately 20 slides with 1-3 objects on each. I plan on creating a unique macro for each slide that will be visible on each excel sheet via a button (this I can do).

    • @SigmaCoding
      @SigmaCoding  3 роки тому +1

      Are you storing your presentation in an object variable? Right now, you just open it, but you don't store it in a variable. That would make it hard to delete all the objects.

    • @michaeljohnston9713
      @michaeljohnston9713 3 роки тому

      Thanks! Got it!

  • @nickthomas8952
    @nickthomas8952 4 роки тому +1

    Thanks for the video! This is super helpful. I am attempting to create an instance of Powerpoint and then open a file template to begin editing that template. I can create the instance of powerpoint, but then once I attempt to open my template Powerpoint crashes and then Excel hangs waiting for external OLE object that is no longer available. Here is my code:
    Set PPTApp = New PowerPoint.Application
    PPTApp.Visible = True
    PPTApp.Activate
    Application.Wait (Now + TimeValue("00:00:05"))
    'MsgBox ("Test Complete")
    Set PPTDoc = PPTApp.Presentations.Open(RootPath & "MyFile.pptx")

    • @SigmaCoding
      @SigmaCoding  4 роки тому

      So what happens when you open the PowerPoint template manually? Does it cause issues? Also, since it's crashing you might want to add an If-statement that quits the script if the "PPTApp" is none.

  • @ghli888
    @ghli888 4 роки тому

    Hi , What should be done if we were looking to do this to the active powerpoint presentation we have open, instead of pasting to a new presentation as described in the video?

    • @SigmaCoding
      @SigmaCoding  4 роки тому +1

      The only section of code that would change is the following:
      'Create a new instance of PowerPoint
      Set PPTApp = New PowerPoint.Application
      PPTApp.Visible = True
      'Create a new presentation
      Set PPTPres = PPTApp.Presentations.Open("C:\Users\305197\Desktop\ShapeFinder.pptm")
      That section creates a new PowerPoint Application object, makes it visible, and opens an existing presentation file that is saved somewhere on the system. To grab the "Active Instance" of the PowerPoint and then Reference the "Active Presentation" you would do the following:
      'Test if PowerPoint is Open, this portion is more for "safety". I can't paste to a presentation if PowerPoint isn't open.
      Set PPTApp = GetObject(, "PowerPoint.Application")
      'If the Application isn't open it will return a 429 error
      If Err.Number = 429 Then
      'It's not open, so let's create a new instance of the application.
      Err.Clear
      Set PPTApp = New PowerPoint.Application
      PPTApp.Visible = True
      End If
      'Grab the Active Presentation
      Set PPTPres = PPTApp.ActivePresentation
      Be careful whenever you work with the "Active Instance" of a Presentation, Workbook, or Document. The "Active Instance" usually means the one that you are currently editing and have a cursor focused in. That means if the user had multiple presentations opened and then didn't have their mouse in the correct one, then it potentially not work.

    • @ghli888
      @ghli888 4 роки тому

      @@SigmaCoding Thank you for the feedback this is very helpful!

  • @meenakshisundaramthambusam7499
    @meenakshisundaramthambusam7499 2 роки тому

    this particular line not working bro