[英]How to attach a excel workbook to slide in power point using vba
[英]VBA - How to select specific charts in excel and paste them on single slide in power point
我有以下代码:
Sub Export_Allcahrts_ppt()
Dim mypowerpoint As PowerPoint.Application
Dim mypowerpoint_pres As PowerPoint.Presentation
Dim myslide As PowerPoint.Slide
Dim mychart As ChartObject
Set mypowerpoint = New PowerPoint.Application
mypowerpoint.Visible = msoTrue
Set mypowerpoint_pres = mypowerpoint.Presentations.Add
Set myslide = mypowerpoint_pres.Slides.Add(1, ppLayoutBlank)
For Each mychart In Sheet1.ChartObjects
mychart.Copy
myslide.Shapes.PasteSpecial ppPasteBitmap
With myslide.Shapes(myslide.Shapes.Count)
.Top = 100
.Height = 200
.Left = 30
End With
Next
End Sub
如何选择特定图表,如Excel中工作表1中的图表1,工作表2中的图表2,并将其粘贴到PowerPoint中的单个幻灯片上?
这将遍历工作簿中的所有工作表,然后仅检查所需的图表。 如果图表的名称类似于sheet1上的chart1,则.....
Set wb as activeworkbook
For Each sht In wb.Worksheets
For Each cht In sht.ChartObjects
'check for name of chart, if statements or a case select statement.
if cht.name = "Chart" & sht.index then
'Copy to PPT
end if
Next cht
Next sht
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.