How to reference worksheet object embedded in Powerpoint using Excel VBA

ee97zzg

New Member
Joined
Jan 2, 2013
Messages
20
Hi VBA Gurus,

I would like to reference a worksheet object which is embedded in PowerPoint can someone advise how I can reference it using VBA.

My code is in Excel Workbook VBA Editor and I have added the powerpoint libary so I will be using th Ealy Binding technique.

The original name of the embedded worksheet is "Obect 1" I have renamed it to "Slide5Sec"

Thanks in advanced
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,305
Re: How to refernce worksheet object embedded in Powerpoint using Excel VBA

Let's assume that pptSlide represents a slide from your presentation. Here's an example...

Code:
    Dim wb As Workbook
    Dim ws As Worksheet
    
    Set wb = pptSlide.Shapes("Slide5Sec").OLEFormat.Object
    Set ws = wb.Worksheets("Sheet1")
    
    ws.Range("A1").Value = "Hello World!"
    
    Set wb = Nothing
    Set ws = Nothing

Hope this helps!
 
Last edited:

ee97zzg

New Member
Joined
Jan 2, 2013
Messages
20
Re: How to refernce worksheet object embedded in Powerpoint using Excel VBA

Thanks Domenic this does exactly what it says on the tin. Brilliant mate thanks :)
 

jlsainz

New Member
Joined
Sep 23, 2019
Messages
1
Re: How to refernce worksheet object embedded in Powerpoint using Excel VBA

hello, I also have a problema when I try to select a cell
what I wat to do is :
ws.range("A1").select.
I'm using the same code. but it is imposible to select.

any advise? thank you very much
 

Watch MrExcel Video

Forum statistics

Threads
1,109,028
Messages
5,526,335
Members
409,696
Latest member
EERS

This Week's Hot Topics

Top