Thursday, May 27, 2010

How to Extract TextBox Contents from All Slides using Powerpoint VBA

Extract Text from Textboxes in Powerpoint slides using VBA

Dedicated to good blogger friend Rahul. This code snippet loops through the slides and extracts the contents of the Textboxes

Sub Extract_TextBox_Text_FromSlides()

Dim oPres As Presentation
Dim oSlide As Slide
Dim oShapes As Shapes
Dim oShape As Shape

Set oPres = ActivePresentation

' --------------------------------------------------
' coded by Shasur for http://vbadud.blogspot.com
' --------------------------------------------------

For Each oSlide In oPres.Slides
    Set oShapes = oSlide.Shapes
    For Each oShape In oShapes
        If oShape.Type = msoTextBox Then
        
            Debug.Print oSlide.Name & vbTab & oShape.TextFrame.TextRange.Text
            
        End If
    Next oShape
Next oSlide



End Sub

3 comments:

  1. Hi Shasur

    i tried to run the code, but where it is storing the text...

    and one more thing please if you can include that it take only the text which is in italic. otherwise it will give so many unwanted things.

    Thanks a lot
    Regards
    Rahul

    ReplyDelete
  2. I am Printing it to immediate window. You can replace the Debug.Print with some variable

    ReplyDelete
  3. Anonymous12:33 PM

    Hi Shasur,
    Need to copy the text from the slide textbox of each slide into the notes section of the corresponding slide. Pl. hint on the macro for that.

    Rgds,
    Murugan

    ReplyDelete

StumbleUpon
Share on Facebook
Related Posts Plugin for WordPress, Blogger...

Visual Basic for Applications (VBA) Forum (recent threads)

CodeKeep VBA Feed

Visual Studio Tools for Office Forum (recent threads)

Download Windows Live Toolbar and personalize your Web experience! Add custom buttons to get the information you care about most.

Office Business Applications (OBA) Team Blog

MSDN Code Gallery Published Resources For Tag VSTO

microsoft.public.vsnet.vstools.office Google Group