Error on Closing PowerPoint Presentation from Excel-VBA

BuRnZz

New Member
Joined
Dec 9, 2020
Messages
27
Office Version
  1. 365
  2. 2016
  3. 2013
Platform
  1. Windows
Hey Everyone,

so i have the following code in order to open a powerpoint presentation which i have embedded into excel, save that powerpoint under a new name to a filepath and then open that powerpoint (so that the new saved powerpoint copy is edited and not the embedded object)


VBA Code:
Sub Erstelle_PowerPoint()

   Application.ScreenUpdating = False 'Soll wohl das Übertragen schneller machen durch Deaktivieren von ScreenUpdating
   Application.DisplayAlerts = False
   Application.Calculation = xlManual
   Application.CutCopyMode = False 'Clipboard leeren


'New PP Instance
Set PPapp = New PowerPoint.Application
PPapp.Visible = msoTrue

MsgBox ("Please pick a filepath to save to."), vbSystemModal 

 With Application.FileDialog(msoFileDialogFolderPicker)
     
   .AllowMultiSelect = False
    
    .Show

     PPdateipfad = .SelectedItems.Item(1) 'String to hold filepath
     End With


Dim oEmbFile As Object

Application.DisplayAlerts = False

Set oEmbFile = ThisWorkbook.Sheets("PP Export").OLEObjects("PP vorlage") 'Opens "PP vorlage", the embedded PP-Presentation template

oEmbFile.Verb Verb:=xlOpen
Set oEmbFile = Nothing

Set PPpres = PPapp.ActivePresentation


'Save as new presentation
PPpres.SaveAs (PPdateipfad + "\TestLink-Report.pptx")
PPpres.Close 'GETTING ERROR HERE "Presentation_" unknown member failed, supposed to close here and then reopen the just saved copy so I dont edit the template but the new copy 
Application.Wait (Now + TimeValue("00:00:02"))
Set PPpres = PPapp.Presentations.Open(PPdateipfad & "\TestLink-Report.pptx", msoTrue) 
Application.Wait (Now + TimeValue("00:00:02"))

End Sub


This worked fine in another project, but now all of a sudden I cant close the presentation after I saved a copy of the template... I updated my Office-Version inbetween projects, anyhting to do with that maybe?

Thanks for the help and any tips are greatly appreciated
cheers
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Came across this thread when I was googling too. Ran into this problem a lot. By the looks of it:

VBA Code:
pres.saved = true
Call Application.Wait(Now() + TimeSerial(0,0,1))
Call pres.close

Works a treat :)
 
Upvote 0

Forum statistics

Threads
1,223,632
Messages
6,173,472
Members
452,516
Latest member
archcalx

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top