Saving Active Powerpoint using Excel

ktkelly_1

New Member
Joined
Jun 13, 2019
Messages
17
[FONT=&quot]Hello hope everyone is well! I am trying to create a macro code to save a powerpoint that I have active and opened I have tried several methos but each one I get different error. So far this is the code that I have as well as the defined parameters. Please let me know if you have any feed back thank you!!![/FONT]
Sub PowerpointRO()
'
' PowerpointUpdate Macro
'
[FONT=&quot]Const nPos As Integer = 13 ' #slide
Dim rng As Range
Set rng = Sheets("Risk & Opp").Range("A1:K10")
Dim obj As Powerpoint.Application
Set obj = CreateObject("Powerpoint.Application")
Dim pre As Presentation
Dim sld As Slide
Dim sH
Dim sW
Set obj = CreateObject("Powerpoint.Application")
Application.ScreenUpdating = False
Dim sFile
sFile = "S:\Projects\2.2 Work products\2.2.2 Systems Engineering\2.2.2.9 Dashboard\Dashboard\Project Report.pptx"
Set pre = obj.Presentations.Open(sFile)
obj.ActiveWindow.View.GotoSlide nPos
Set sld = pre.Slides(nPos)
rng.Copy
sld.Shapes.PasteSpecial DataType:=2
Application.CutCopyMode = False
With pre.PageSetup
sH = .SlideHeight
sW = .SlideWidth
End With
With obj.ActiveWindow.Selection.ShapeRange
.Width = 400
.Align msoAlignCenters, True
.Align msoAlignMiddles, True
End With
Application.ScreenUpdating = True
'obj.Quit
End Sub
[/FONT]

Sub PowerpointAL()
'
' PowerpointUpdate Macro
'
Sub SavePPT()
Windows("Project Reporet Dasboard").Activate
ActiveWorkbook.SaveAs fileName:= _
("S:\Projects\2.2 Work products\2.2.2 Systems Engineering\2.2.2.9 Dashboard\Dashboard\Project Report Dashboard" & Format(Now(), YYYY.MM.DD) & ".xlsm")
ActiveWorkbook.SaveAs fileName:= _
("S:\Projects\2.2 Work products\2.2.2 Systems Engineering\2.2.2.9 Dashboard\Dashboard\Archive\Project Report Dashboard" & Format(Now(), YYYY.MM.DD) & ".xlsm")
End Sub
[FONT=&quot]I am hoping to save the power point in two different folders. Let me know if I can help in anyway![/FONT]
 

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.
Re: Saving Active Powerpoint Uisng Excel

Sub SavePPT()
Windows("Project Reporet Dasboard").Activate
ActiveWorkbook.SaveAs fileName:= _
("S:\Projects\2.2 Work products\2.2.2 Systems Engineering\2.2.2.9 Dashboard\Dashboard\Project Report Dashboard" & Format(Now(), YYYY.MM.DD) & ".xlsm")
ActiveWorkbook.SaveAs fileName:= _
("S:\Projects\2.2 Work products\2.2.2 Systems Engineering\2.2.2.9 Dashboard\Dashboard\Archive\Project Report Dashboard" & Format(Now(), YYYY.MM.DD) & ".xlsm")
End Sub
this is actually the wrong coding for power point specific but it is still messed up saying object required, but I have used this in the past and never had a problem so I'm not sure what the problem is.

the code that I do need edited is actually the one below along with the one above.
Sub SavePPT()
Dim ppPres As Presentation
Dim fileNameString As String
Dim ppApp As Powerpoint.Application


Dim obj As Powerpoint.Application


fileNameString1 = "S:\Projects\STV_Plus\2 Project Execution Data\2.2 Work products\2.2.2 Systems Engineering\2.2.2.9 Dashboard\Dashboard\Project Report - " & Format(Now(), "YYYY.MM.DD") & ".pptx" '<change to your file path/name
fileNameString2 = "S:\Projects\STV_Plus\2 Project Execution Data\2.2 Work products\2.2.2 Systems Engineering\2.2.2.9 Dashboard\Dashboard\Archive\Project Report - " & Format(Now(), "YYYY.MM.DD") & ".pptx"




'Create an instance of PPT to work with
Set ppApp = CreateObject("Powerpoint.Application")
ppApp.Visible = True


'Create a new presentation (or you can access an existing file with ppApp.Presentations.Open


'Save:
ActivePresentation.SaveCopyAs fileName:=fileNameString1
ActivePresentation.SaveCopyAs fileName:=fileNameString2




End Sub
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,138
Members
453,021
Latest member
Justyna P

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