Copy and Pasting Picture to PowerPoint

ktkelly_1

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

Some videos you may like

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.

Domenic

MrExcel MVP
Joined
Mar 10, 2004
Messages
19,193
Try...

Code:
Sheets("Cinco Bugs").Pictures(PicName).Copy
Hope this helps!
 

Watch MrExcel Video

Forum statistics

Threads
1,099,990
Messages
5,471,838
Members
406,789
Latest member
gkfcosta

This Week's Hot Topics

Top