|
楼主 |
发表于 2015-10-30 22:09
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Private Sub CommandButton1_Click()
- Set 工作表 = ThisWorkbook.Sheets("Sheet2")
- ' Acrobat 4,5,6 时
- ' Dim objAcroPDDoc As Acrobat.CAcroPDDoc
- ' Set objAcroPDDoc = CreateObject(“AcroExch.PDDoc”)
- ' Acrobat 7,8,9,10,11 时
- Dim objAcroPDDoc As New Acrobat.AcroPDDoc
-
- Dim lRet As Long
-
- Dim strGetFileName As String
- Dim strGetFlags As String
- Dim strGetInfo As String
- Dim strGetNumPages As String
- Dim strGetPageMode As String
- Dim strGetPermanentID As String
- Dim i As Long
-
- i = 1
- Const CON_NAME = "C:\222.pdf"
- lRet = objAcroPDDoc.Open(CON_NAME)
- Debug.Print "lRet = " & lRet
-
- 'PDF文件名
- strGetFileName = objAcroPDDoc.GetFileName
- 工作表.Cells(i, 1).Value = "GetFileName = " & strGetFileName
- i = i + 1
-
- strGetFlags = objAcroPDDoc.GetFlags
- 工作表.Cells(i, 1).Value = "GetFlags = " & strGetFlags
- i = i + 1
-
- 'PDF文件总页数
- strGetNumPages = objAcroPDDoc.GetNumPages
- 工作表.Cells(i, 1).Value = "GetNumPages = " & strGetNumPages
- i = i + 1
-
- 'PDF文件显示模式
- strGetPageMode = objAcroPDDoc.GetPageMode
- 工作表.Cells(i, 1).Value = "GetPageMode = " & strGetPageMode
- i = i + 1
-
- '参数ID
- strGetPermanentID = objAcroPDDoc.GetPermanentID
- 工作表.Cells(i, 1).Value = "GetPermanentID = " & strGetPermanentID
- i = i + 1
- strGetInfo = objAcroPDDoc.GetInfo("Title")
- 工作表.Cells(i, 1).Value = "GetInfo(""Title"") = " & strGetInfo
- i = i + 1
-
- '文档属性标题
- strGetInfo = objAcroPDDoc.GetInfo("Subject")
- 工作表.Cells(i, 1).Value = "GetInfo(""Subject"") = " & strGetInfo
- i = i + 1
-
- '文档作者
- strGetInfo = objAcroPDDoc.GetInfo("Author")
- 工作表.Cells(i, 1).Value = "GetInfo(""Author"") = " & strGetInfo
- i = i + 1
-
- '文档属性标题
- strGetInfo = objAcroPDDoc.GetInfo("Keywords")
- 工作表.Cells(i, 1).Value = "GetInfo(""Keywords"") = " & strGetInfo
- i = i + 1
-
- '文档作者
- strGetInfo = objAcroPDDoc.GetInfo("Creator")
- 工作表.Cells(i, 1).Value = "GetInfo(""Creator"") = " & strGetInfo
- i = i + 1
-
- '文档创建日期
- strGetInfo = objAcroPDDoc.GetInfo("CreationDate")
- 工作表.Cells(i, 1).Value = "GetInfo(""CreationDate"") = " & strGetInfo
- i = i + 1
-
- '文档修改日期
- strGetInfo = objAcroPDDoc.GetInfo("ModDate")
- 工作表.Cells(i, 1).Value = "GetInfo(""ModDate"") = " & strGetInfo
- i = i + 1
-
- 'PDF制作程序
- strGetInfo = objAcroPDDoc.GetInfo("Producer")
- 工作表.Cells(i, 1).Value = "GetInfo(""Producer"") = " & strGetInfo
-
- 'PDF释放对象
- objAcroPDDoc.Close
- Set objAcroPDDoc = Nothing
-
- End Sub
复制代码 |
|