ich habe das Problem, dass ich - via VBA - eine Tabelle aus Excel kopieren und dieses ins Powerpoint hineinzupasten sollte. Danach sollte ich die Position (top, left) sowie Höhe und Breite (heigth, width) bestimmen.
Bei Bildern funktioniert dies, bei Tabellen hingegen nicht. Weiss da jemand Rat?
Gruss & Danke
Hein
Public Sub grafiken_einfügen()
Dim i As Integer
Dim xl_path As String
Dim xl_wb_name As String
Dim xl_ws_name As String
Dim xl_chart_name As String
Dim pp_slide_no As Long
Dim pp_left_points As Long
Dim pp_top_points As Long
Dim pp_width_points As Long
Dim pp_height_points As Long
Dim objPowerpoint As Object
Set objPowerpoint = CreateObject("Powerpoint.Application")
objPowerpoint.Visible = True
Dim pp_presentation As String
i = 2
Do Until IsEmpty(Cells(i, 1).Value)
xl_path = Cells(i, 1).Value
xl_wb_name = Cells(i, 2).Value
xl_ws_name = Cells(i, 3).Value
xl_type_name = Cells(i, 4).Value
xl_chart_name = Cells(i, 5).Value
pp_presentation = Cells(i, 6).Value
pp_slide_no = Cells(i, 7).Value
pp_left_points = Cells(i, 8).Value
pp_top_points = Cells(i, 9).Value
pp_width_points = Cells(i, 10).Value
pp_height_points = Cells(i, 11).Value
Workbooks.Open xl_path & xl_wb_name, UpdateLinks:=0
Worksheets(xl_ws_name).Shapes(xl_chart_name).Copy
objPowerpoint.Presentations.Open pp_presentation, ReadOnly:=msoFalse
objPowerpoint.ActiveWindow.View.Paste
With objPowerpoint.ActiveWindow.Selection.ShapeRange
.Left = pp_left_points
.Top = pp_top_points
.Width = pp_width_points
.Height = pp_height_points
End With
i = i + 1
Loop
End Sub