首页 > 解决方案 > VBA从excel粘贴到Powerpoint

问题描述

    Sub jede_Grafik_nach_PowerPoint()
'Extras - Verweise: Microsoft PowerPoint x.x Object Library
Dim Grafik As Shape

Dim PP As Object
Set PP = CreateObject("Powerpoint.Application")


Dim PP_Datei As PowerPoint.Presentation
Dim PP_Folie As PowerPoint.Slide
Dim ws As Worksheet
Dim wb As Workbook
Set wb = ThisWorkbook
Set PP_Datei = PP.Presentations.Open("C:\Users\akaygun\Desktop\test.pptm")

PP.Visible = msoTrue

'Set PP_Datei = PP.ActivePresentation wenn akt. Präsi sein soll
For Each ws In wb.Sheets

If Left(ws.Name, 3) = "MLK" Then
 'neue Folie einfügen
   PP_Datei.Slides(3).Copy
    PP_Datei.Slides.Paste
    Set PP_Folie = PP_Datei.Slides(PP_Datei.Slides.Count)
 'copypaste
 ws.Shapes("Stunden").Copy

PP_Folie.Shapes.Paste
    PP_Folie.Shapes("Stunden").Top = 315.1991
    PP_Folie.Shapes("Stunden").Left = 22.17449

 ws.Shapes("Tage").Copy

    PP_Folie.Shapes.Paste
    PP_Folie.Shapes("Tage").Top = 10.16945
    PP_Folie.Shapes("Tage").Left = -2.806772


End If

Next ws



End Sub

亲爱的社区,我正在尝试通过 VBA 自动将图表从 excel 粘贴到 Powerpoint。运行此 Sub 时,它总是说:“远程服务器计算机不存在”'462' 我已经尝试设置一个新的演示文稿而不是一个对象,但它没有帮助。

标签: excelvbapowerpoint

解决方案


推荐阅读