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]
 

Some videos you may like

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

ktkelly_1

New Member
Joined
Jun 13, 2019
Messages
17
Re: Saving Active Powerpoint Uisng Excel

this reply was deleted
 
Last edited:

ktkelly_1

New Member
Joined
Jun 13, 2019
Messages
17
Re: Saving Active Powerpoint Uisng Excel

this reply was deleted
 
Last edited:

ktkelly_1

New Member
Joined
Jun 13, 2019
Messages
17
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
 

Watch MrExcel Video

Forum statistics

Threads
1,102,641
Messages
5,488,049
Members
407,619
Latest member
obriende

This Week's Hot Topics

  • Timer in VBA - Stop, Start, Pause and Reset
    [CODE=vba][/CODE] Option Explicit Dim CmdStop As Boolean Dim Paused As Boolean Dim Start Dim TimerValue As Date Dim pausedTime As Date Sub...
  • how to updates multiple rows in muliselect listbox
    Hello everyone. I need help with below code. code is only chaning 1st row in mulitiselect list box. i know issue with code...
  • Delete Row from Table
    I am trying to delete a row from a table using VBA using a named range to find what I need to delete. My Range is finding the right cell. In the...
  • Assigning to a variable
    I have a for each block where I want to assign the value in column 5 of the found row to the variable Serv. [CODE=vba] For Each ws In...
  • Way to verify information
    Hi All, I don't know what to call this formula, and therefore can't search. I have a spreadsheet with information I want to reference...
  • Active Cell Address – Inactive Sheet
    How to use VBA to get the cell address of the active cell in an inactive worksheet and then place that cell address in a location on the current...
Top