雷火电竞-中国电竞赛事及体育赛事平台

歡迎來到入門教程網!

vb

當前位置:主頁 > 軟件編程 > vb >

vba 獲取PPT幻燈片中的所有標題的代碼

來源:本站原創(chuàng)|時間:2020-01-10|欄目:vb|點擊:

復制代碼 代碼如下:

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
'循環(huán)每頁幻燈
For i = 1 To oPres.Slides.Count
Set oSlide = oPres.Slides.Item(i)
'獲取圖形對象
For j = 1 To oSlide.Shapes.Count
Set oShape = oSlide.Shapes.Item(j)
'如果有文字
If oShape.TextFrame.HasText = msoTrue Then
Set tr = oShape.TextFrame.TextRange
sText = tr.Text
'如果符合格式: 根據情況設定, 此處前三位構成為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

上一篇:自動復制U盤文件的VBS腳本

欄    目:vb

下一篇:VBS 偏移量解密工具[算法解密]

本文標題:vba 獲取PPT幻燈片中的所有標題的代碼

本文地址:http://www.jygsgssxh.com/a1/vb/7498.html

網頁制作CMS教程網絡編程軟件編程腳本語言數據庫服務器

如果侵犯了您的權利,請與我們聯(lián)系,我們將在24小時內進行處理、任何非本站因素導致的法律后果,本站均不負任何責任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網 版權所有