Im currently trying to do the following steps:
To do this I have embedded the PP-Template as an OLEO-Object (via Insert-->Object-->Choose PPTX) named "PPtemplate" on a Worksheet called "PP Export" and run the following code:
'Dim oEmbFile As Object
'Application.DisplayAlerts = False
'Set oEmbFile = ThisWorkbook.Sheets("PP Export").OLEObjects("PPtemplate")
'oEmbFile.Verb Verb:=xlOpen
'Set oEmbFile = Nothing
'Set PPpres = PPapp.ActivePresentation
'Application.DisplayAlerts = True
This works very well, except I can only do this once. This is because once the first macro edits the template, it automatically saves these changes and the template is not the template anymore but rather the result of the first macro run (edited template)...
How can I stop it from overriding itsself? Maybe somehow extract the template to the User-PC then open and edit it, so the embedded template is always the same even after you run the macro?
Any help/tips would be greatly appreciated! Thanks and stay healthy
EDIT - Solution:
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.Show
PPdateipfad = .SelectedItems.Item(1)
End With
Dim oEmbFile As Object
Application.DisplayAlerts = False
Set oEmbFile = ThisWorkbook.Sheets("PP Export").OLEObjects("PPvorlage")
oEmbFile.Verb Verb:=xlOpen
Set oEmbFile = Nothing
Set PPpres = PPapp.ActivePresentation
Application.DisplayAlerts = True
PPpres.SaveAs (PPdateipfad + "\QM-Check Präsentation.pptx")
PPpres.Close
Set PPpres = PPapp.Presentations.Open(PPdateipfad + "\QM-Check Präsentation.pptx")
Solution:
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
.Show
PPdateipfad = .SelectedItems.Item(1)
End With
Dim oEmbFile As Object
Application.DisplayAlerts = False
Set oEmbFile = ThisWorkbook.Sheets("PP Export").OLEObjects("PPvorlage")
oEmbFile.Verb Verb:=xlOpen
Set oEmbFile = Nothing
Set PPpres = PPapp.ActivePresentation
Application.DisplayAlerts = True
PPpres.SaveAs (PPdateipfad + "\QM-Check Präsentation.pptx")
PPpres.Close
Set PPpres = PPapp.Presentations.Open(PPdateipfad + "\QM-Check Präsentation.pptx")