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
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Try...

Code:
Sheets("Cinco Bugs").Pictures(PicName).Copy

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
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