Hello Heinz,
try this code:
Option Explicit
Sub testList()
Dim ws As Worksheet
Dim rg As Range, x&
Dim rList As Range, cell As Range
Dim ppApp As Object
Dim ppPres As Object
Dim sl As Object, sh As Object
Set ws = ThisWorkbook.Worksheets("Outputtable")
Set rg = ws.Range("A1")
Set rList = ThisWorkbook.Sheets("List").Range("A2:A" & Sheets("List").Range("A" & Rows.Count).End(xlUp).Row)
On Error Resume Next
Set ppApp = GetObject(class:="PowerPoint.Application")
Err.Clear
If ppApp Is Nothing Then
Set ppApp = CreateObject(class:="PowerPoint.Application")
End If
If Err.Number = 429 Then
MsgBox "PowerPoint Apps not found - terminating..."
Exit Sub
End If
On Error GoTo 0
On Error GoTo ErrHandler
Application.ScreenUpdating = False
Set ppPres = ppApp.Presentations.Add
x = 0
For Each cell In rList
rg.Value = cell.Value
ws.Range("A1").CurrentRegion.Copy
Set sl = ppPres.Slides.Add(1 + x, 12)
sl.Shapes.PasteSpecial DataType:=2
Set sh = sl.Shapes(sl.Shapes.Count)
sh.Left = 200
sh.Top = 80
x = x + 1
Next cell
ppApp.Visible = True
ppApp.Activate
Application.ScreenUpdating = True
Application.CutCopyMode = False
Exit Sub
ErrHandler:
Application.ScreenUpdating = True
MsgBox ("An error has occured:" & vbLf & Err.Number & " : " & Err.Description), vbOKOnly + vbInformation
End Sub
Make sure you have set reference to Microsoft PowerPoint Object Library. I'm sorry I could not find out how to upload the file.
Will do later when I get how to..
Regards,
sysss
Bookmarks