+ Reply to Thread
Results 1 to 14 of 14

Pasting Selected Ranges into a PowerPoint Slides

  1. #1
    Registered User
    Join Date
    03-16-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Pasting Selected Ranges into a PowerPoint Slides

    You will find two attachements to this thread. One is a completed example I found pasting charts into PowerPoint Presentation and the other is my example of what I would like done. Difference here is that I am not using charts, instead I am using selected ranges to paste in a PowerPoint Presentation.

    Instead of pasting charts to Excel, I would like to make each colored range a slide in the PowerPoint (Please see attachment).

    So by click on the command button "Create PowerPoint Presentation", I would like to have PowerPoint open and the two colored ranges should be in the PowerPoint Presentation as Slide 1 and Slide2.

    I have done some research on this topic and found information, but I have not clue as how to do it.
    Attached Files Attached Files
    Last edited by NaNaBoo; 04-02-2009 at 10:58 AM. Reason: Marking As Solved

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Pasting Selected Ranges into a PowerPoint Slides

    Did you want ranges as slide or Shapes as slides? The 2nd xls has two rectangle shapes.

    This example copies 4 ranges as images to slides.
    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 03-31-2009 at 05:09 PM.

  3. #3
    Registered User
    Join Date
    03-16-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: Pasting Selected Ranges into a PowerPoint Slides

    This is exactly what I wanted. Now, I know that I may be asking for too much here.
    But when the ranges are sent to the PowerPoint Presentation as a picture object, its' size is bigger than the width and height of the PowerPoint slide. Is there a away to create a code that will resize the picture object to automatically fit evenly in the PowerPoint slide?

    Please see my new attachment with the problem I am having
    Last edited by NaNaBoo; 04-01-2009 at 11:57 AM.

  4. #4
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Pasting Selected Ranges into a PowerPoint Slides

    You wanted all the ranges on one slide?

    For each range in its own slide and sized to fit width I used this code. I added Early binding so you can change it back or add the reference or just add the line were I set the Range areas and the slide shape's Width. If Height is set 2nd, the width expands over the page width.

    If you wanted to include your rectangle shapes this will do it as well. In fact, we could code it to get the area ranges based on rectangular shapes over the ranges.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-16-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: Pasting Selected Ranges into a PowerPoint Slides

    I hope I did not confuse you. Initially, I did ask for you to have all of the ranges be on individuals slides. I just wanted to have the option to also fit all of the ranges on one slide and size it to fit on the PowerPoint.

  6. #6
    Registered User
    Join Date
    03-16-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: Pasting Selected Ranges into a PowerPoint Slides

    When I copy and paste the new code into the previous Excel attachment, I get an error. The code does not work.

    Please try your code in the previous spreadsheet and let me know what happens on your end.

    Thanks

  7. #7
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Pasting Selected Ranges into a PowerPoint Slides

    "Get an error" and "code does not work" go hand in hand I would think. Obviously it would "error" if you did not set the PowerPoint object reference as I explained. If you want to stick with late binding we can do that of course. Sometimes I do both types of object binding. I will design it with early binding and make the production version late binding so that I don't have to worry about versions of application objects. Sometimes, I use both to get the best of both worlds.

    Also, keep in mind what I said about width and height. One will govern the other so order will matter or simply do not use the other. I guess we could make code to decide the matter for us. We might be able to expand the Width or Height but you would loose your scale and it might look odd.

    To put the whole range into one slide, I will show the early binding method first and then your late binding last. Basically, you just need that one line for Height in this scenario.

    Early Binding:
    Please Login or Register  to view this content.
    Late Binding:
    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 04-01-2009 at 02:40 PM.

  8. #8
    Registered User
    Join Date
    03-16-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: Pasting Selected Ranges into a PowerPoint Slides

    Sorr,

    As I was trying to see the difference between the first and second code you had given me, I notice that you had a comment in there about

    Please Login or Register  to view this content.
    I thought this option was in Excel, so started look there and got distracted with other work.

    So, does all of my user have to set this everytime the click on the command button to create the PowerPoint presentation?

    I am very new to this whole programming in Excel, so you have to bear with my ignorance on understanding the code.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Pasting Selected Ranges into a PowerPoint Slides

    ... do all of my user have to set this every time ...
    The reference is in the workbook, so no.

    One of the (few) advantages of late binding is that it will work for users who have PPT 10 or 12 instead of PPT 11.
    Entia non sunt multiplicanda sine necessitate

  10. #10
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Pasting Selected Ranges into a PowerPoint Slides

    Hopefully, the binding issue does not confuse you too much. Just stick with late binding if it does.

    For what is worth, each Application will have their Application object pre-defined and set so they can use early binding right away. This is where we get the A in VBA. So one Application. will vary depending or where the VBA code resides: Excel, MSWord, PowerPoint, WordPerfect, etc.

    A couple of links on binding:
    http://support.microsoft.com/kb/245115
    http://www.*****-clicks.com/excel/olBinding.htm

  11. #11
    Registered User
    Join Date
    03-16-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: Pasting Selected Ranges into a PowerPoint Slides

    Thanks Kenneth and Shg,

    I copied and pasted the late binding in the spreadsheet it size the height as it should have, but the width in the PowerPoint Presentation is cutting off a part of the range. Therefore, from Range(s:z) is not showing on the slide. I tried to play around with the code and revise these line

    Please Login or Register  to view this content.
    But things got worst.

    I also reverified that the Range was correct in the code:

    Please Login or Register  to view this content.
    Nothing happened

    What do I need to to adjust the width so that it includes all of the range I have specified?

    Also, keep in mind what I said about width and height. One will govern the other so order will matter or simply do not use the other. I guess we could make code to decide the matter for us. We might be able to expand the Width or Height but you would loose your scale and it might look odd.
    I know that Kenneth touched on losing scale. Will this still be the case with the Range(A2:Z77)? Is there any other ideas I can use?

    Please see the attachement
    Last edited by NaNaBoo; 04-01-2009 at 03:38 PM.

  12. #12
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Pasting Selected Ranges into a PowerPoint Slides

    It is a weird deal for sure. I will have to think on this some. For one thing, I noticed that your range has joined cells. Try unjoining them and just making your columns wide enough. You can always use AutoFit to fit your data.

    Some other approaches might be to export the range as a file and import that. This will probably be too advanced for you to explore on your own right now. The thread that might help is: http://www.excelforum.com/excel-prog...ge-as-jpg.html

  13. #13
    Registered User
    Join Date
    03-16-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: Pasting Selected Ranges into a PowerPoint Slides

    Thanks for the reply. I will try your first suggestion and "unmerged" the cells. That is a good start. I will let you know what happens.

    Stay tune.

  14. #14
    Registered User
    Join Date
    03-16-2009
    Location
    California, USA
    MS-Off Ver
    Excel 2003
    Posts
    98

    Re: Pasting Selected Ranges into a PowerPoint Slides

    Thank you Kenneth Hobson for all the hard work you put into this.

    I finally have gotten around to playing with your code and I was able to get all of the ranges to fit on the PowerPoint Slide. With excellent readability. It looks great!!

    Here is how I revised your code:

    Please Login or Register  to view this content.

+ Reply to Thread

LinkBacks (?)

  1. Page
    Refback This thread
    10-04-2013, 05:52 AM

Thread Information

Users Browsing this Thread

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

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