VBA gets code _VBA for all headings in a ppt slide

Source: Internet
Author: User
Copy Code code as follows:

Private Sub CommandButton1_Click ()
me.enabled = False
GetTitles
me.enabled = True
End Sub


Sub GetTitles ()
On Error Resume Next
Dim Opres as Presentation
Set opres = application.activepresentation
Dim oslide as Slide
Dim oshape as Shape
Dim TR as TextRange
Dim Stext as String
Dim I as Long, J as Long
' Cycle per page slideshow
For i = 1 to OPres.Slides.Count
Set oslide = OPres.Slides.Item (i)
' Get the drawing object
For j = 1 to OSlide.Shapes.Count
Set oshape = OSlide.Shapes.Item (j)
' If there is text
If OShape.TextFrame.HasText = MsoTrue Then
Set tr = OShape.TextFrame.TextRange
Stext = tr. Text
' If the format: according to the situation set, here the first three bits constitute x.y
If IsNumeric (Left (stext, 3)) Then
' MsgBox stext
Textbox1.selstart = 65535
Textbox1.seltext = stext & vbCrLf
End If
Set tr = Nothing
End If
Set oshape = Nothing
Next
Set oslide = Nothing
Next
Set opres = Nothing
End Sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.