How to embed an entire excel worksheet in powerpoint using VBA

  • Hello.
    I have a specific problem.


    I need to embed/insert a whole excel sheet into a powerpoint presentation as an object.


    I have to use VBA to pull details from excel sheet and populate a PPT template. There is another workbook which is supposed to be inserted as an object, e.g. excel icon will be there in the powerpoint and on clicking it the the worksheet will open.


    Here is what I have been using:

    Code
    1. oPS=oPP.Slides(1)
    2. oPS.Shapes.AddOLEObject _
    3. Classname:="Excel.sheet",FileName:="abc.xls",DisplayAsIcon:=msoTrue


    where oPS is

    Code
    1. Dim oPS As Powerpoint.slide


    The error is am getting is:
    shapes(unknown member): invalid request


    There was some info on net but they were using ActivePresentation and I am creating macro in excel not in powerpoint.


    Sorry If a lot of what I say is not making much sense. I am a total newbie to VBA and this is a one off assignment. Any help will be greatly appreciated.

  • Re: How to embed an entire excel worksheet in powerpoint using VBA


    Hi download2live


    Do not cross post without mentioning it. X-posting is when you post the same question on other forums, newsgroups etc. Calling 10 Taxi Cabs, and jumping in in the first one that arrives is not the kind of ethics that we want.


    Please read the Forum Rules regarding Cross Posting. The volunteers in this forum (and similar forums) spend time and effort to provide solutions, and it would be in their best interest that it doesn't go waste as someone across the globe spent similar amount of time and effort and posted a solution.


    The ditto of this thread is found here, Need help to embed a whole excel worksheet in Powerpoint posted by you.


    You can cross post politely by mentioning that you have done so, and by providing the link to the same.


    Please take time to read and understand the forum rules. Any violations will lead to thread deletion without warning, and/or posting privileges being revoked.

  • Re: How to embed an entire excel worksheet in powerpoint using VBA


  • Re: How to embed an entire excel worksheet in powerpoint using VBA


    I am really really sorry about that. Actually the deadline is this Monday itself and was rather desperate. So....
    Won't do it again. Promise.:smile:


    Will try out the code changes. Hope that it will work out.
    Thanks a lot for your efforts.


    Wishing you loads of good luck.

  • Re: How to embed an entire excel worksheet in powerpoint using VBA


    Sorry for late update. I tested it and it worked fine. Many thanks.


    There is only one thing still rattling me. Headers and footers. The Powerpoint I am using as template has a Slidemaster. I need to update the same via VBA.
    To be more clear I need to change the header text in all the slides.


    Currently I am doing something like this from excel.



    When I do this I get error saying:
    invalid request. Slides don't have headers.


    I might be doing something real stupid here. Any pointers???

  • Great..i need to insert excel in active slide not in new ppt file, can you please help me

    Also, instead of ( Filename:="E:\Documents and Settings\User\My Documents\abc.xlsm"). can i open specified location manually and select the excel file.

  • Welcome to the Forum


    Please start your own post. Posting in another member's Thread is known as hijacking and is not allowed here. By all means add a link to a Thread that may be related to your question.

  • royUK

    Closed the thread.