Hello hope everyone is doing great!
So I am trying to copy and paste these pictures with specific "names" onto specific slide onto an existing PowerPoint. Below is the code that I am currently using please let me know if I can expound in anyway. I keep getting an error message on the bold, red and underlined line
Sub PowerpointCB()
'
' PowerpointCB Macro
'
Dim PicName As Variant
Dim pic As Object
PicName = "Cinco Bug All Screenshot"
Const nPos As Integer = 5 ' #slide
Sheets("Cinco Bugs").Array(PicName).Copy
Dim sFile
pre.SaveAs sFileArchiveToday
Dim obj As PowerPoint.Application
Set obj = CreateObject("Powerpoint.Application")
Application.ScreenUpdating = False
Set pre = obj.Presentations.Open(sFile)
obj.ActiveWindow.View.GotoSlide nPos
Set sld = pre.Slides(nPos)
sld.Shapes(1).Delete
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
.Height = 400
.Align msoAlignCenters, True
.Align msoAlignMiddles, True
End With
Application.ScreenUpdating = True
sFileArchiveToday = "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"
pre.SaveAs sFileToday
'obj.Quit
End Sub
So I am trying to copy and paste these pictures with specific "names" onto specific slide onto an existing PowerPoint. Below is the code that I am currently using please let me know if I can expound in anyway. I keep getting an error message on the bold, red and underlined line
Sub PowerpointCB()
'
' PowerpointCB Macro
'
Dim PicName As Variant
Dim pic As Object
PicName = "Cinco Bug All Screenshot"
Const nPos As Integer = 5 ' #slide
Sheets("Cinco Bugs").Array(PicName).Copy
Dim sFile
pre.SaveAs sFileArchiveToday
Dim obj As PowerPoint.Application
Set obj = CreateObject("Powerpoint.Application")
Application.ScreenUpdating = False
Set pre = obj.Presentations.Open(sFile)
obj.ActiveWindow.View.GotoSlide nPos
Set sld = pre.Slides(nPos)
sld.Shapes(1).Delete
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
.Height = 400
.Align msoAlignCenters, True
.Align msoAlignMiddles, True
End With
Application.ScreenUpdating = True
sFileArchiveToday = "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"
pre.SaveAs sFileToday
'obj.Quit
End Sub