ゴール:現在のExcel VBAがオブジェクトとして添付されているPowerPointプレゼンテーションのパスとファイル名を取得します。Excelがオブジェクトとして添付されているPowerPointプレゼンテーションのファイル名とパスを取得します。
以下のスクリーンショットは、より良い私が何を意味するか説明するかもしれない:
これは、私はいくつかのプレゼンテーションを同時に開いている場合、必要なプレゼンテーションを見つける必要があるために使用されるコードです
Option Explicit
Sub UpdatePowerPoint(PowerPointFile)
Dim ppProgram As Object
Dim ppPres As Object
Dim CurOpenPresentation As Object
On Error Resume Next
Set ppProgram = GetObject(, "PowerPoint.Application")
On Error GoTo 0
If ppProgram Is Nothing Then
Set ppProgram = CreateObject("PowerPoint.Application")
Else
If ppProgram.Presentations.Count > 0 Then
For Each CurOpenPresentation In ppProgram.Presentations ' loop through all open presnetations (check Full Name: Path and name)
Dim CleanFullName As String * 1024
CleanFullName = Replace(CurOpenPresentation.FullName, "%20", " ") ' replace Sharepoint characters %20 with Space ("_")
If StrComp(PowerPointFile, CleanFullName, vbTextCompare) = 0 Then
Set ppPres = CurOpenPresentation
Exit For
End If
Next CurOpenPresentation
End If
End If
End Sub
質問::私は行方不明です - (と私はPresntation名を渡す必要はありませんが、私は、私はに位置していた中でのプレゼンテーションを取得することができ、これまでにないんだけど) n Excel/Office "Trick":Excelファイルを何らかの形でプレゼンテーションと結びつける "トリック"ですか?たぶんいくつかの他の解決策?
"勇敢" downvoterは、理由を説明できますか? –
私は理解していますが、このActivePresentation.Slides(1).Shapes(3).OLEFormat.Object.application.activeworkbook.name'のようなものは、呼び出されているワークブックに対してこれをチェックしています。 2つのヘッダーでスライドし、3番目がデータなので、スライド上でこれらのタイプのオブジェクトを確認する必要があります) –
明確にするために、Powerpointプレゼンテーションファイルの名前とパスへの参照をプレゼンテーション内に埋め込まれたExcelワークブック内のVBAコード? PowerpointのVBAコードに、プレゼンテーションからExcel VBAコードへのファイル名とパスの参照を渡す必要はありませんか? – SteveES