merc1286
01-16-2018, 12:57 PM
Hi. I have a Powerpoint deck that I use as a "template" to generate new deck. The template has a bunch of slides in it with their layout all set, and a macro that does the following when run:
Creates a copy of the deck (in the background, the show flag is FALSE) with:
Dim newpres As Presentation
Set newpres = Presentations.Open(ActivePresentation.FullName, False, True, False)
It then does all of its work to change newpres. When it's done, it saves and closes newpres with the following code:
Set savename = Application.FileDialog(Type:=msoFileDialogSaveAs)
With savename
.InitialFileName = "New Chart.pptx"
If .Show = -1 Then
strMyFile = .SelectedItems(1)
newpres.SaveAs (strMyFile)
Else
MsgBox "No File Entered. Cancelling.", , "No Filename"
End If
End With
newpres.Close
The problem I'm having is that once that is done, if you make any changes to the TEMPLATE file and try to save them, you get 2 popups. The first one says "An error occurred while Powerpoint was saving the file", and the second one says "We're sorry, something went wrong that might make Powerpoint unstable. Please save your presentations and restart Powerpoint".
If I try to save the template file with a new name, it works fine. Any changes I make to the template file BEFORE I run the macro also will save fine. But once I run the macro, I get those errors unless I either save it with a new name or just close the file without saving.
Any ideas? Thanks!
Creates a copy of the deck (in the background, the show flag is FALSE) with:
Dim newpres As Presentation
Set newpres = Presentations.Open(ActivePresentation.FullName, False, True, False)
It then does all of its work to change newpres. When it's done, it saves and closes newpres with the following code:
Set savename = Application.FileDialog(Type:=msoFileDialogSaveAs)
With savename
.InitialFileName = "New Chart.pptx"
If .Show = -1 Then
strMyFile = .SelectedItems(1)
newpres.SaveAs (strMyFile)
Else
MsgBox "No File Entered. Cancelling.", , "No Filename"
End If
End With
newpres.Close
The problem I'm having is that once that is done, if you make any changes to the TEMPLATE file and try to save them, you get 2 popups. The first one says "An error occurred while Powerpoint was saving the file", and the second one says "We're sorry, something went wrong that might make Powerpoint unstable. Please save your presentations and restart Powerpoint".
If I try to save the template file with a new name, it works fine. Any changes I make to the template file BEFORE I run the macro also will save fine. But once I run the macro, I get those errors unless I either save it with a new name or just close the file without saving.
Any ideas? Thanks!