excelvbaoledde

Error when opening PowerPoint from Excel VBA


I've searched through a huge number of posts looking for VBA code within Excel which opens a PowerPoint presentation. The vast majority suggest that I use the following code (with variations on the names of variables). There are some variations which I have found but none of them work either:

Dim objPPT As Object
Set objPPT = CreateObject("Powerpoint.Application")
objPPT.Visible = True
objPPT.Presentations.Open "C:\Users\7233025\Desktop\Workmix Resolutions.xlsm"

When I try to run this, the application freezes for about a minute before returning the following error message:

Microsoft Excel is waiting for another application to complete an OLE action

The application then continues to attempt to run the macro and the only way to stop it is to open the task manager and end the process. This is the case when PowerPoint is open when i attempt to run the code, and when it is closed.

Searching for assistance on the OLE error, most advice is to set the application to 'Ignore other applications that use Dynamic Data Exchange (DDE)' however this does not resolve the problem for me.

As this doesn't seem to be an issue for anyone else in the forums I've searched, is it likely to be something on my employer's network or on the computer preventing the file opening or have I made a mistake somewhere?


Solution

  • In

    objPPT.Presentations.Open "C:\Users\7233025\Desktop\Workmix Resolutions.xlsm"
    

    The file you should try to open should be an ppt file not an excel file. Example

    objPPT.Presentations.Open "C:\example.pptx"