パワポでクリップボードの値を取得する方法を記載します。
あまり用途はないけど、たまたま作ったので記録。
通常、クリップボードの値を取得するには参照設定が必要だが、いろいろ制約があったので迂回した。
ロジック
- クリップボードの値を、新規のShapeに値貼り付け
- 作成したShapeから文字列を取得
- 作成したShapeを削除
Public Sub Test() As Slide
Dim ActiveSlide As Powerpoint.Slide
Dim sText As String
Set ActiveSlide = ActivePresentation.Slides.FindBySlideID(ActivePresentation.Windows(1).Selection.SlideRange.SlideID)
On Error GoTo err_
With ActiveSlide.Shapes.PasteSpecial(ppPasteText)
sText = .TextFrame.TextRange.Text
.Visible = False
Call .Delete
End With
On Error GoTo 0
Set ActiveSlide = Nothing
MsgBox sText
err_:
End Function