VBA Code to Open and Save a PowerPoint File using an Excel cell value

sirbudan82

New Member
Joined
Feb 3, 2016
Messages
16
I'm using a simple VBA code to open a PowerPoint file from an Excel file.
Sub PPT()
Dim myPresentation As Object
Dim PowerPointApp As Object
Set myPresentation = CreateObject("Powerpoint.application")
myPresentation.presentations.Open "C:\Folder\Subfolder\F11_Blank.pptx"
myPresentation.Visible = True
myPresentation.SaveAs "C:\Folder\Subfolder\F11_Updated.pptx"
End Sub

For the moment I need to update the path of the file every time the folder name changes, I was wondering if there is a way to reference the path file to an Excel cell value and avoid opening the visual basic editor. Another option would be to browse the folder when opening and then to select the path when saving.

Any help would be really appreciated, many thanks.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Tip: Click the # icon on reply toolbar to insert code tags. Paste code between tags to keep structure.
Code:
Sub PPT()
  Dim myPresentation As Object, PowerPointApp As Object, p$
  p = Worksheets(1).[A1] '"C:\Folder\Subfolder\
  Set myPresentation = CreateObject("Powerpoint.application")
  myPresentation.presentations.Open p & "F11_Blank.pptx"
  myPresentation.Visible = True
  myPresentation.SaveAs p & "F11_Updated.pptx"
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,473
Messages
6,125,020
Members
449,203
Latest member
tungnmqn90

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