VBA从Excel粘贴到Powerpoint

时间:2018-08-14 08:45:23

标签: excel vba 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' 我已经尝试设置一个新的Presentation而不是一个Object,但是它没有帮助。

0 个答案:

没有答案
相关问题