これは、あなたを前進させるのに役立つはずです。必要なすべての書式設定プロパティを含むシェイプ オブジェクトを、開いている 1 つのプレゼンテーションから別の開いているプレゼンテーションにコピーします。実際には、達成しようとしていることに基づいて、プレゼンテーション、スライド、シェイプの参照を動的にしますが、これは原則を示すための実例です。
Option Explicit
' Macro to copy the first shape from the first slide of open presentation 1 to the first slide of open presentation 2
' Requires that 2 presetnations are open and that the first has a shape on slide 1
' Wriiten by Jamie Garroch of youpresent.co.uk
Sub PassTextBoxBetweenPresentations()
Dim oSrcShp As Shape ' Source Shape in Presentation 1
Dim oTgtShp As Shape ' Source Shape in Presentation 2
' Set a reference to a shape in the first presentation, in this case, the first shape on the first slide
Set oSrcShp = Presentations(1).Slides(1).Shapes(1)
' Copy the shape (with all of its properties) to the clipboard
oSrcShp.Copy
' Paste the shape from the first presentation to the second presentation
Presentations(2).Slides(1).Shapes.Paste
' Set a reference to the pasted shape
Set oTgtShp = Presentations(2).Slides(1).Shapes(Presentations(2).Slides(1).Shapes.Count)
' Do stuff with your pasted shape object
With oTgtShp
Dim headlines
If .HasTextFrame Then
If .TextFrame.HasText Then
headlines = .TextFrame.TextRange.Text
Debug.Print headlines
End If
End If
End With
' Clean up
Set oSrcShp = Nothing: Set oTgtShp = Nothing
End Sub