|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Need help in open a PowerPoint presentation form Excel and save it with different name
I have written a macro, in a part of it, I want to open a PowerPoint presentation form Excel workbook and save it with a different name, but when running the code, the code encounters an error in the last line (PPTX.ActivePresentation.saveas Filename:="C:\Users\s.kalantari\Desktop\dailyrepor t01.PPTX")
, saying “Run time error 424, object required. (The part of Macro with this issue is as following: Sub Saveas() Dim objPPTX As Object Set objPPTX = createobject("PowerPoint.Application") objPPTX.Visible = True objPPTX.Presentations.Open "C:\Users\s.kalantari\Desktop\14010127.pptx", Untitled:=msoTrue PPTX.ActivePresentation.saveas Filename:="C:\Users\s.kalantari\Desktop\dailyrepor t01.PPTX" End Sub Another question I have is this: If I want to use an Excel cell value (a variable) for the new name of saved file, dose the following code can do job? (Assuming the first problem is solved and cell value is not empty). Sub Saveas() Dim objPPTX As Object Dim cell01 As variant Cell01=Range("A1").Value Set objPPTX = createobject("PowerPoint.Application") objPPTX.Visible = True objPPTX.Presentations.Open "C:\Users\s.kalantari\Desktop\14010127.pptx", Untitled:=msoTrue PPTX.ActivePresentation.saveas Filename:="C:\Users\s.kalantari\Desktop\&cell01&”. PPTX" End Sub Any help will be appreciated. Thanks in advance. |
#2
|
||||
|
||||
shouldn't the line which causes the error begin:
objPPTX rather than PPTX ? Part 2: objPPTX.ActivePresentation.saveas Filename:="C:\Users\s.kalantari\Desktop" & cell01 & ". PPTX" (not tested. cell01 shouldn't contain any illegal filename characters) I suspect there's a way to change file names without opening the file at all. |
#3
|
|||
|
|||
Thank you very much. Your reply solved the problem.
|
Tags |
saveas |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Interactive chart link from Excel to PowerPoint presentation | vili999 | PowerPoint | 0 | 04-13-2018 09:11 AM |
Not able to Open/ save Excel Documents | M S Bhurji | Excel | 2 | 05-16-2016 08:33 AM |
open powerpoint 2011 presentation in PC | jerryny | PowerPoint | 0 | 09-10-2014 03:42 PM |
How can I save a macro in the PowerPoint 2007 default presentation | mrayncrental | PowerPoint | 1 | 06-09-2014 06:13 AM |
How do I auto-update the TODAY excel function within PowerPoint show presentation? | Powerpoint100 | PowerPoint | 0 | 02-12-2013 01:45 PM |