tbakbradley
Board Regular
- Joined
- Sep 24, 2010
- Messages
- 141
I have a large Macro for building a PowerPoint Sketch from information on an Excel File. The VBA is within Excel. Everything works as intended. The Macro will Open a Powerpoint file "MyTemplate.pptx" and it will update Text Boxes and Objects within that "MyTemplate.pptx" powerpoint. I do NOT want the user to accidentally click "Save" and it overwrite the Template with whatever their Macro just updated it with.
In testing, I thought I had this working, but never actually "Saved" my file, so assumed it worked until I put it in production and now I can't figure out the issue.
Here is what I have at the END of my VBA Code in Excel. My entire macro runs fine, it opens teh "MyTemplate.pptx" file, it updates everything I need it to on that PowerPoint sketch, and it even opens up the Save As Diaglog box with the File name pre populated with "CaseNumber_PrelimSketch.pptx". I didn't want to Save it so the User can choose the directory they want to save it. However, when I click Save, the dialog box disappears as expected, but the File Name shown on my sketch is still "MyTemplate.pptx". I didn't realize this until after I clicked Save, and made an adjustment to my powerpoint sketch and clicked the "Save" Button, then realized I saved a new "MyTemplate.pptx" File to the server. I have a backup and was able to resolve.....but this is an issue.
Any ideas what I did wrong below? Again, the Save As Dialog box does popup just like had I clicked Save As.....it even has the File Name pre-populated as described above, but when you click "Save" it closes and doesn't actually save the file to your destination nor file name.
Thanks!!
In testing, I thought I had this working, but never actually "Saved" my file, so assumed it worked until I put it in production and now I can't figure out the issue.
Here is what I have at the END of my VBA Code in Excel. My entire macro runs fine, it opens teh "MyTemplate.pptx" file, it updates everything I need it to on that PowerPoint sketch, and it even opens up the Save As Diaglog box with the File name pre populated with "CaseNumber_PrelimSketch.pptx". I didn't want to Save it so the User can choose the directory they want to save it. However, when I click Save, the dialog box disappears as expected, but the File Name shown on my sketch is still "MyTemplate.pptx". I didn't realize this until after I clicked Save, and made an adjustment to my powerpoint sketch and clicked the "Save" Button, then realized I saved a new "MyTemplate.pptx" File to the server. I have a backup and was able to resolve.....but this is an issue.
Any ideas what I did wrong below? Again, the Save As Dialog box does popup just like had I clicked Save As.....it even has the File Name pre-populated as described above, but when you click "Save" it closes and doesn't actually save the file to your destination nor file name.
Thanks!!
VBA Code:
Dim defaultFileName As String
Dim CaseNumber As String
CaseNumber = Sheets("Data").Range("CsxCaseNumber")
defaultFileName = CaseNumber & "_" & "PrelimSketch"
With MyPPT.FileDialog(2)
.InitialFileName = defaultFileName
.Show
End With