'How can I get the displayed range of an embedded Excel worksheet in a PowerPoint slide via VBA?

As the title explains, how do I gather the displayed range of an Excel OLE Object embedded in a PowerPoint slide via VBA? I've looked through the zipped files but I couldn't find anything in the .xlm files. I've noticed when you 'Edit' the OLE Object, the displayed range is captured by shaded border, see below for a picture. (https://i.stack.imgur.com/WE5UU.png)

I'm trying to gather this information to copy the cells in range and paste them back into the slide as ppt table objects. This is so that I can ultimately extract the data via python.

I've tried several different VBA functions including wb.Windows(1).VisibleRange.Address, wb.ActiveSheet.UsedRange.Address, wb.Windows(1).Selection.Address but none of them accurately capture just the displayed data.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source