Save As Dialog Box with File Name Predetermined for Ppt file through Excel

tbakbradley

Board Regular
Joined
Sep 24, 2010
Messages
142
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!!

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
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,223,681
Messages
6,173,815
Members
452,535
Latest member
berdex

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