Friday, July 15, 2011

copy data from text boxes in powerpoint to excel in excel VBA

If you would like to import the text from the text boxes in powerpoint slides to excel sheet

Here is the code-

Sub import_textbox_text_ppt_excel()
' refrence select Microsoft powerpoint
Dim PPApp As PowerPoint.Application
Dim PPPres As PowerPoint.Presentation
Dim PPSlide As PowerPoint.Slide
Dim oPS As PowerPoint.Slide
Dim Shp As Object
Dim abc As Table
Set PPApp = New PowerPoint.Application

i = 1
PPApp.Visible = True

Set PPPres = PPApp.Presentations.Open("C:\Documents and Settings\achamanlalko\Desktop\powerpoint to excel\export text from text box to excel.pptx")

For Each oPS In PPPres.Slides


For Each Shp In oPS.Shapes
If Shp.TextFrame.HasText Then
' shape name
ThisWorkbook.Sheets(1).Cells(i, 1).Value = Shp.Name
' slide name
ThisWorkbook.Sheets(1).Cells(i, 2).Value = oPS.Name
' shape text
ThisWorkbook.Sheets(1).Cells(i, 3).Value = Shp.TextFrame.TextRange.Text
i = i + 1
End If
Next
Next
PPPres.Close
PPApp.Quit

Set PPSlide = Nothing

'
Set PPPres = Nothing
Set PPApp = Nothing
ThisWorkbook.Activate
ThisWorkbook.Sheets(1).Select
MsgBox "done"


End Sub

Powerpoint Slide http://www.filefactory.com/file/cc6b872/n/export_text_from_text_box_to_excel.pptx


Excel Macro File

http://www.filefactory.com/file/cc6b89d/n/powerpoint_to_excel_1.xlsm

No comments:

Post a Comment

Import data from SQL

Macro to import data from SQL using ADO connection string: Sub Import_data_from_SQL() ' Tools -> References -> Microsoft Active...