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

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.

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,101,851
Messages
5,483,306
Members
407,393
Latest member
GeorgeBrown

This Week's Hot Topics

  • Finding issue in If elseif else with For each Loop
    Finding issue in If elseif else with For each Loop I have tried this below code but i'm getting in Y column filled with W005. Colud you please...
  • MsgBox Error
    Hi Guys, I have the below error show up when i try and run my macro in File1 but works fine if i copy and paste the same code into file2. [ATTACH...
  • CELL FORMAT - IF CONDITION
    My Cell Format is [B]""0.00" Cr". [/B]But in the cell, it is showing 123.00 for editing. (123 is entry figure). (Data imported from other...
  • Show numbers nearly the same
    Is this possible. I have a number that can change very time eg 0.00001234 Then I have a lot of numbers 0.0000001, 0.0000002, 0.00000004...
  • Please i need your help to create formula
    I need a formula in cell B8 to do this >>if b1=1 then multiply ( cell b8) by 10% ,if b1=2 multiply by 20%,if=3 multiply by 30%. Thank you in...
  • Got error while adding column and filter
    Got error while adding column and filter In column Z has some like "Success" and "Error". I want to add column in AA if the Z cell value is...
Top