Quantcast
Channel: Adobe Community : 人気のディスカッション - Acrobatコミュニティフォーラム (Japan)
Viewing all articles
Browse latest Browse all 10240

Excel VBAを使ってテキストフィールドの値を取得したい

$
0
0

pdfファイルにnameというテキストフィールドを作り、その中に文字を記入して保存しました。
その文字をExcel VBAを使って取出したいのですが、うまくいきません。
コードは以下、
Sub main()
Dim objAcroApp    As New Acrobat.AcroApp
Dim objAcroAVDoc  As New Acrobat.AcroAVDoc
Dim objAcroPDDoc  As Acrobat.AcroPDDoc
Dim lRet          As Long
Dim jso           As Object
Dim text1, text2  As String
Dim nPages As Integer

'Acrobatアプリケーションを起動する。
lRet = objAcroApp.Show
'PDFファイルを開いて表示する。
lRet = objAcroAVDoc.Open("P:\test2.pdf", "")
'PDDocオブジェクトを取得する
Set objAcroPDDoc = objAcroAVDoc.GetPDDoc()
'JavaScriptオブジェクトを作成する。
Set jso = objAcroPDDoc.GetJSObject

nPages = jso.numPages
text1 = jso.documentfilename
text2 = jso.getfield("name").Value


'PDFファイルを閉じます。
lRet = objAcroAVDoc.Close(1)
'Acrobatアプリケーションを終了する。
lRet = objAcroApp.Hide
lRet = objAcroApp.Exit
'OLEを行うとAcrobatが不安定になるので一応オブジェクトを強制開放する。
Set objAcroPDDoc = Nothing
Set objAcroAVDoc = Nothing
Set objAcroApp = Nothing
End Sub

nPagesやtext1は読み取れますが、text2 = jso.getfield("name").Valueの行で「エラー424 オブジェクトが必要です。」となってしまいます。
VBAからだとgetFieldメソッドは使えないのでしょうか?。


Viewing all articles
Browse latest Browse all 10240

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>