+ Reply to Thread
Results 1 to 7 of 7

VBA access to Excel object in PowerPoint

  1. #1
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    72

    VBA access to Excel object in PowerPoint

    Hello VBA/Excel/PowerPoint folks,

    I am having an issue with an embedded Excel Object in PowerPoint that I'm hoping someone can assist me with. I posted my question in the PowerPoint forum here, but doesn't appear to be much traffic there as here...

    I am running PowerPoint 2010 and while I'm ok with general usage, I'm not as familiar with the inner workings as I am with Excel. From what I've Googled, there is no longer a Record Macro option in PP 2010 so my main method of learning is not available in PowerPoint.

    In my current presentation, I have multiple slides with embedded Excel spreadsheets (Insert -> Table -> Excel Spreadsheet). Multiple people will be updating various slides and there's no guarantee they'll refocus the excel object to cells to "A1" to ensue the correct information is displayed when the presentation runs.

    What I want to do is create a macro that will go through each slide and set the focus of each embedded excel sheet to cell "A1" to ensure when the presentation runs the information I want displayed is in frame.

    I have generated the below code thus far:

    Please Login or Register  to view this content.
    that can write to cell A1 or any other cell that I want, but if cell AZ1234 is displayed on screen, I can't get it to scroll up to cell A1 to display the information I want.

    I've tried .Select, .SetFocus .Show and a few others but either nothing happens or I get an error.

    for .Select I get the error: "Run-Time Error '1004' Select method of Range failed"

    Can anyone provide any assistance or direction in this (I'm assuming/hoping) simple Macro?

    r/

    SUPPO

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: VBA access to Excel object in PowerPoint

    Hi SUPPO

    I 100% agree about recording macros in PowerPoint. It's more than 10 years since they dropped the capability and I still miss it.

    This seems to work for me, run within PP. Perhaps you can tweak it to suit.

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    06-18-2012
    Location
    Chennai, India
    MS-Off Ver
    Excel 2003, 2010
    Posts
    212

    Re: VBA access to Excel object in PowerPoint

    upload a sample file to analyze

  4. #4
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: VBA access to Excel object in PowerPoint

    NickyC,

    Thanks for your help thus far. that does actually work..... partially.

    There are 4 slides in this presentation. Slides 2-4 have an embedded Excel Object. Cell A1 has data that I want displayed in a presentation. If a user edits the file and leaves the focus on cell “XFD1048576” as it is in this file, I want a macro that will go through all the slides and refocus each excel object on cell “A1”

    The Macro I have thus far is:
    Please Login or Register  to view this content.
    When running this I get an error: “OLEFormat (unknown member): Invalid request. The window must be in slide or notes view.”

    If I navigate to slide 2 in slide or notes view and modify the code to this:

    Please Login or Register  to view this content.
    it works perfectly. I'm working to figure you how to cycle through the slides and will try to find a way to upload a sample file. I can't seem to do it from work at the moment.

    r/

    SUPPO

  5. #5
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: VBA access to Excel object in PowerPoint

    I've attached a sample file that has the issue I'm trying to solve. I had to put it in a .zip file since we're not able to upload .ppt files...

    r/

    SUPPO
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: VBA access to Excel object in PowerPoint

    VBA Gurus, can one of you come up with something more functional than this?

    If not, this is really slows and clunky but seems to work. The difficulty I hadwas that, to change the selection, you have to actually open each workbook which makes it slow and unstable. Its much easier to manipulate the contents without opening the sheet, but that won't change the visible cell.

    you will need to have the Microsoft excel object library checked for it to work (in powerpoint's VBA select tools > references and scroll down to msexcelobject. The name will vary a bit depending on your version).

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-15-2010
    Location
    CT
    MS-Off Ver
    Excel 2010
    Posts
    72

    Re: VBA access to Excel object in PowerPoint

    thanks NickyC,

    It works as I'd hoped it would. as you say, it is a bit clunky, but it works for the 22ish slides that I have. It'd be nice if there was a .screenrefresh method in PPT, but I found a go around/alternate option via google that I may implement if it comes to that point.

    r/

    SUPPO.

+ 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. [SOLVED] Help pasting linked object from Excel into PowerPoint
    By Bjordion in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-24-2013, 12:52 PM
  2. Problem with pasted Excel object in PowerPoint
    By Bjordion in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-14-2013, 04:05 PM
  3. Powerpoint PPSX Object in Excel
    By beickholt in forum Excel General
    Replies: 0
    Last Post: 07-03-2012, 02:49 PM
  4. Locking access to embedded Excel files from within Powerpoint
    By dylanemcgregor in forum Excel General
    Replies: 2
    Last Post: 09-24-2009, 02:48 PM
  5. PowerPoint Object in Excel Macro
    By SmartS.101 in forum Excel General
    Replies: 6
    Last Post: 07-30-2009, 09:29 AM
  6. Importing Excel Object in Powerpoint
    By technically challanged in forum Excel General
    Replies: 0
    Last Post: 01-31-2005, 06:06 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