Hi All!
I have a question regarding looping through all tables and copy them to excel.
However, user defined function error keep pooping up. Is there any quick fix?
I have a question regarding looping through all tables and copy them to excel.
VBA Code:
Sub PP_Test()
Const filename = "C:\Users\file.pptm"
Dim wbk As Workbook, wsh As Worksheet
Dim pptApp As PowerPoint.Application, pptPres As PowerPoint.Presentation
Set pptApp = New PowerPoint.Application
pptApp.Visible = True
Set pptPres = pptApp.Presentations.Open(filename)
Set wbk = Workbooks("Test.xlsm")
'Loop through the slides and loop through the shapes to find all the Tables. Copy the table, and paste them in Excel
Dim s As PowerPoint.Slide, sh As PowerPoint.Shape
For Each s In pptPres.Slides
For Each sh In s.Shapes
'Create a new sheet in Excel
Set wsh = wbk.Worksheets.Add(After:=wbk.Worksheets(wbk.Worksheets.Count))
' Copy/paste the shape/table
sh.Copy
wsh.Paste
Next sh
Next s
End Sub
However, user defined function error keep pooping up. Is there any quick fix?