Search code examples
vbaexcelpowerpoint

Saving a file to dynamic path which is a value in Excel cell


I have a vba code in PowerPoint which saves the file automatically with the name of an Excel file which is active.

 PowerPointApp.ActivePresentation.SaveAs "Z:\05_PROJECT\Tanverdi\" & Replace(ThisWorkbook.Name, "xlsm", "ppt"), 1

Different people are going to use this macro and they all have different folders that they are using. So i want the path of the folder to be dynamic too. The best solution would be getting the path name from my active Excel cell, so that they can write the path name in an Excel cel and then I can use this cell value as a path.

But how could I do this ?


Solution

  • Let's say the path is in Sheet1/Cell A1, replace your hard coded path with:

    PowerPointApp.ActivePresentation.SaveAs ThisWorkbook.Sheets(1).Range("A1").Value & Replace(ThisWorkbook.Name, "xlsm", "ppt"), 1