将更多excel形状复制到powerpoint中

时间:2014-03-20 14:07:05

标签: excel-vba powerpoint powerpoint-vba vba excel

我有以下代码让我复制

Sub pptCopy()

Dim pptapp As PowerPoint.Application
Dim ppt As PowerPoint.Presentation
Dim slide As PowerPoint.slide
Dim shape1 As PowerPoint.shape

var2 = "C:\Documents and Settings\aa471714\Desktop\Presentation2.pot"

Set pptapp = CreateObject("Powerpoint.Application")
Set ppt = pptapp.Presentations.Open(var2)
Set slide = ppt.Slides(2)
Set shape1 = slide.Shapes.Paste(1)

pptapp.Visible = True

Call copyExcel1

With shape1

.Left = 100
.Width = 100

End With

End Sub

另一个宏

Sub copyExcel1()

Dim oExcel As Excel.Application
Dim oWB As Workbook
Dim cht As Excel.ChartObject

var2 = "C:\Documents and Settings\aa471714\Desktop\Template.xls"
Set oExcel = New Excel.Application
Set oWB = oExcel.Workbooks.Open(var2)

oExcel.Visible = True

Sheets("Sheet5").ChartObjects("AchmeaBankNL").Chart.ChartArea.Copy


End Sub

但我有两个问题:

  • 我想将excel图片移动到powerpoint中的特定位置(fe shape 3)
  • 我想要复制超过excel数字(我需要复制2,一个复制形状3,一个复制形状4)。

有人知道我应该如何编辑下面的代码来实现这个目标吗?

亲爱的,

Marc

1 个答案:

答案 0 :(得分:0)

首先,您应该编辑问题的主题;它似乎与问题本身无关。

将形状移动到"堆叠"中的特定位置。订购,使用类似这样的功能:

Function ShapeToZOrder(oSh As Shape, lPosition As Long)
    oSh.ZOrder msoSendToBack
    Do Until oSh.ZOrderPosition = lPosition
        oSh.ZOrder msoBringForward
    Loop
End Function