AlternativeText
プロパティを使用して、インライン シェイプを参照できます。PDF がプログラムによって埋め込まれている場合は、各 PDF のファイル名を取得し、そのファイル名を に割り当てますAlternativeText
。
NewShapeIndex = ActiveDocument.InlineShapes.Count + 1
'Code to embed shape and capture filename of PDF
ActiveDocument.InlineShapes(NewShapeIndex).AlternativeText = CapturedFilename
(PDF が手動で埋め込まれている場合は、埋め込まれた PDF アイコンを右クリックし、[オブジェクトの書式設定] を選択して、各ファイルの [代替テキスト] タブのボックスにファイル名を入力します。)
次に、InlineShapes
コレクションを使用して、ファイル名に基づいてファイルを起動します。
Public Sub PDFindex(PDFname As String)
Dim Myshape As InlineShape
Dim IndexCount As Integer
IndexCount = 1
For Each Myshape In ActiveDocument.InlineShapes
If Myshape.AlternativeText = PDFname Then
ActiveDocument.InlineShapes(IndexCount).OLEFormat.Activate
End If
IndexCount = IndexCount + 1
Next
End Sub
このようにして、ファイルの名前を知っている限り、任意のファイルを起動できます
PDFindex filename