I know this question has been asked before but as I am no VBA expert, I can't seem to get any of the solutions to work for my particular scenario so I was hoping someone could help.
I have some VBA code that copies a selection from Excel, opens a new powerpoint presentation based on a template and then pastes the data into slide two of powerpoint.
The only thing I want to do now is manipulate the size and position of the chart once it is there. What do I need to add to this code below to make that happen?
'Opens a new PowerPoint presentation based on template and pastes data into Slide 2 of Powerpoint from Excel
Dim PPapp As PowerPoint.Application, PPpres As PowerPoint.Presentation, PPslide As PowerPoint.Slide
Dim XLws As Worksheet
Set XLws = ActiveSheet
Set PPapp = New PowerPoint.Application
Set PPpres = PPapp.Presentations.Open("C:\Users\Colin\Dropbox (Edge45)\Edge45 Team Folder\Edge45 Company Documents\Templates\Powerpoint Templates\Edge45 Audit Template Macro.potm", Untitled:=msoTrue)
PPapp.Visible = True
Set PPslide = PPpres.Slides(2)
XLws.Range("A1:D16").Copy
PPslide.Shapes.PasteSpecial DataType:=ppPasteHTML, Link:=msoFalse
Application.CutCopyMode = False
Define a Shape object and play around :
'Opens a new PowerPoint presentation based on template and pastes data into Slide 2 of Powerpoint from Excel
Dim PPapp As PowerPoint.Application, PPpres As PowerPoint.Presentation, PPslide As PowerPoint.Slide, PPShape As Object
Dim XLws As Worksheet
Set XLws = ActiveSheet
Set PPapp = New PowerPoint.Application
Set PPpres = PPapp.Presentations.Open("C:\Users\Colin\Dropbox (Edge45)\Edge45 Team Folder\Edge45 Company Documents\Templates\Powerpoint Templates\Edge45 Audit Template Macro.potm", Untitled:=msoTrue)
PPapp.Visible = True
Set PPslide = PPpres.Slides(2)
XLws.Range("A1:D16").Copy
Set PPShape = PPslide.Shapes.PasteSpecial(DataType:=ppPasteHTML, Link:=msoFalse)
Application.CutCopyMode = False
With PPShape
.Top = 10
.Height = 100
.Left = 10
.Width = 100
End With
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.