Nathan Schroeder
Nathan Schroeder

Reputation: 1

Slide Selection in PPT on Mac OS

I am trying to create a VBA program to take screen shots from excel to paste them in a PPT template. I have been able to have success with Windows, but I am struggling to get this to work on MAC. I know that there are issues getting Office family products to talk to each other on Office for Mac, but I'm hoping that some of the older problems have been fixed. The questions about this topic, for the most part, are a few years old.

I am able to use the code below to open a ppt template from a directory, but as soon as I try to select a specific slide, it crashes excel. This is the most comprehensive dialog about this topic, but its from around 3 years ago. https://answers.microsoft.com/en-us/msoffice/forum/all/vba-copy-from-mac-excel-2016-and-paste-to/7d177c40-501b-471f-b4b4-81735652d492

Am I missing something stupid? Is there a workaround? Half of my organization uses PC and half Mac, so just using Windows isn't the solution.

Sub CreateDealReviewPPT()

    'Declare PPT Variables
    Dim PPTApp As PowerPoint.Application
    Dim PPTPres As PowerPoint.Presentation
    Dim PPTSlide As PowerPoint.Slide
    Dim PPTShape As PowerPoint.Shape

    'Ranges for the directories
    PPTTemplate = Sheets("Start Here - ISSP Instructions").Range("PPTTemplate").Value

    Set PPTApp = CreateObject("PowerPoint.Application")
    Set PPTPres = PPTApp.Presentations.Open(PPTTemplate)
        PPTApp.Visible = True
        PPTApp.Activate

    PPTSlide = PPTPres.Slides(5)
    PPTSlide.Select

When I get to the PPTSlide = PPTPres.Slides(5) it crashes.

I am on Mac OS Catalina. I am using Excel and PPT versions 16.37 on office365.

Upvotes: 0

Views: 212

Answers (1)

John Korchok
John Korchok

Reputation: 4913

Office for Mac has a long-standing known bug with CreateObject. It just doesn't work.

In addition, the OLE implementation in Office for Mac is limited in PowerPoint. You can call Excel and Word objects from PowerPoint, but you can't call PowerPoint from either Word or Excel.

On top of that, the post-2011 PowerPoint VBA object model is full of holes: commands and parameters that work fine in Windows fail on the Mac. Sorry, but it's a mess.

Upvotes: 2

Related Questions