Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-19-2022, 08:16 PM
soroush.kalantari soroush.kalantari is offline Need help in open a PowerPoint presentation form Excel and save it with different name Windows 10 Need help in open a PowerPoint presentation form Excel and save it with different name Office 2016
Competent Performer
Need help in open a PowerPoint presentation form Excel and save it with different name
 
Join Date: Jun 2021
Posts: 115
soroush.kalantari is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 04-20-2022, 07:11 AM
p45cal's Avatar
p45cal p45cal is offline Need help in open a PowerPoint presentation form Excel and save it with different name Windows 10 Need help in open a PowerPoint presentation form Excel and save it with different name Office 2019
Expert
 
Join Date: Apr 2014
Posts: 863
p45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant futurep45cal has a brilliant future
Default

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.
Reply With Quote
  #3  
Old 04-21-2022, 04:46 AM
soroush.kalantari soroush.kalantari is offline Need help in open a PowerPoint presentation form Excel and save it with different name Windows 10 Need help in open a PowerPoint presentation form Excel and save it with different name Office 2016
Competent Performer
Need help in open a PowerPoint presentation form Excel and save it with different name
 
Join Date: Jun 2021
Posts: 115
soroush.kalantari is on a distinguished road
Default

Thank you very much. Your reply solved the problem.
Reply With Quote
Reply

Tags
saveas

Thread Tools
Display Modes


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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft