Skip to content

Instantly share code, notes, and snippets.

@shoveller
Created September 23, 2012 08:38
Show Gist options
  • Save shoveller/3769378 to your computer and use it in GitHub Desktop.
Save shoveller/3769378 to your computer and use it in GitHub Desktop.
파워포인트VBA_스닙펫:검색조건에 부합하는 텍스트를 VBE콘솔에 출력
'작성일 : 2012.09.05
'작성자 : 서재원
'설명 : 파워포인트용 VBA모듈
' 파워포인트 택스트를 검색한다.
' 검색조건에 부합하는 텍스트를 디버깅 창에 출력한다.
'검색조건 딕셔너리 프로퍼티
Private Property Get keyWordsPatterns() As Collection
Dim patterns As New Collection
'이 시점에 검색할 문자열을 추가한다.
'RegExp형식이어야 한다.
Call patterns.Add("*삼성*")
Set keyWordsPatterns = patterns
End Property
'파워포인트 슬라이드 프로퍼티
Sub GetSpecificText()
Dim p As Presentation: Set p = ActivePresentation
Dim s As Slide
Dim sh As Shape
For Each s In p.Slides
For Each sh In s.Shapes
If sh.HasTextFrame Then
If sh.TextFrame.HasText Then
Dim index As Long
For index = 1 To keyWordsPatterns.Count
If sh.TextFrame.TextRange.Text Like keyWordsPatterns(index) Then
Debug.Print sh.TextFrame.TextRange.Text
End If
Next index
End If
End If
Next
Next
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment