{"id":13440,"date":"2021-01-06T12:00:04","date_gmt":"2021-01-06T03:00:04","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=13440"},"modified":"2021-01-06T13:16:44","modified_gmt":"2021-01-06T04:16:44","slug":"pdf%e3%81%ae%e3%81%97%e3%81%8a%e3%82%8a%e6%83%85%e5%a0%b1%e3%82%92%e5%87%ba%e5%8a%9b%e3%81%99%e3%82%8bvba%e3%83%9e%e3%82%af%e3%83%ad","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=13440","title":{"rendered":"PDF\u306e\u3057\u304a\u308a\u60c5\u5831\u3092\u51fa\u529b\u3059\u308bVBA\u30de\u30af\u30ed"},"content":{"rendered":"<p><a href=\"https:\/\/community.adobe.com\/t5\/acrobat%E3%83%95%E3%82%A9%E3%83%BC%E3%83%A9%E3%83%A0\/bd-p\/acrobat-jp?page=1&#038;sort=latest_replies&#038;filter=all\" title=\"Acrobat\u30d5\u30a9\u30fc\u30e9\u30e0 - Adobe Support Community\" target=\"_blank\" rel=\"noopener\">Acrobat\u30d5\u30a9\u30fc\u30e9\u30e0<\/a>\u306e\u4e0b\u8a18\u30b9\u30ec\u30c3\u30c9\u3067\u5f53\u30d6\u30ed\u30b0\u3078\u306e\u30ea\u30f3\u30af\u304c\u8cbc\u3089\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u6c17\u304c\u4ed8\u304d\u307e\u3057\u305f\u3002<\/p>\n<div class=\"linkcard\"><div class=\"lkc-external-wrap\"><div class=\"lkc-unlink\"><div class=\"lkc-card\"><div class=\"lkc-info\"><div class=\"lkc-favicon\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.google.com\/s2\/favicons?domain=community.adobe.com\" alt=\"\" width=\"16\" height=\"16\" \/><\/div><div class=\"lkc-domain\">community.adobe.com<\/div><\/div><div class=\"lkc-content\"><figure class=\"lkc-thumbnail\"><img decoding=\"async\" class=\"lkc-thumbnail-img\" src=\"https:\/\/s.wordpress.com\/mshots\/v1\/https%3A%2F%2Fcommunity.adobe.com%2Ft5%2Facrobat%25E3%2583%2595%25E3%2582%25A9%25E3%2583%25BC%25E3%2583%25A9%25E3%2583%25A0%2Fvba%25E3%2581%25A7pdf%25E3%2581%25AE%25E3%2581%2597%25E3%2581%258A%25E3%2582%258A%25E3%2581%25A8%25E3%2582%25B8%25E3%2583%25A3%25E3%2583%25B3%25E3%2583%2597%25E5%2585%2588%25E3%2582%2592%25E8%25A4%2587%25E6%2595%25B0%25E9%259A%258E%25E5%25B1%25A4%25E3%2581%25AE%25E5%2585%25A8%25E3%2581%25A6%25E5%258F%2596%25E5%25BE%2597%25E3%2581%2597%25E3%2581%259F%25E3%2581%2584%25E3%2581%25A7%25E3%2581%2599%2Ftd-p%2F11715925?w=100\" width=\"100px\" height=\"108px\" alt=\"\" \/><\/figure><div class=\"lkc-title\">An Unexpected Error has occurred. - Adobe Support Community<\/div><div class=\"lkc-url\" title=\"https:\/\/community.adobe.com\/t5\/acrobat%E3%83%95%E3%82%A9%E3%83%BC%E3%83%A9%E3%83%A0\/vba%E3%81%A7pdf%E3%81%AE%E3%81%97%E3%81%8A%E3%82%8A%E3%81%A8%E3%82%B8%E3%83%A3%E3%83%B3%E3%83%97%E5%85%88%E3%82%92%E8%A4%87%E6%95%B0%E9%9A%8E%E5%B1%A4%E3%81%AE%E5%85%A8%E3%81%A6%E5%8F%96%E5%BE%97%E3%81%97%E3%81%9F%E3%81%84%E3%81%A7%E3%81%99\/td-p\/11715925\"><strike>https:\/\/community.adobe.com\/t5\/acrobat\u30d5\u30a9\u30fc\u30e9\u30e0\/vba\u3067pdf\u306e\u3057\u304a\u308a\u3068\u30b8\u30e3\u30f3\u30d7\u5148\u3092\u8907\u6570\u968e\u5c64\u306e\u5168\u3066\u53d6\u5f97\u3057\u305f\u3044\u3067\u3059\/td-p\/11715925<\/strike><\/div><div class=\"lkc-excerpt\">Come for help, be inspired. The Adobe Support Community is the place to ask questions, find answers, learn from experts and share your knowledge. We have everything to<\/div><\/div><div class=\"clear\"><\/div><\/div><\/div><\/div><\/div>\n<p>VBA\u3067PDF\u306e\u8907\u6570\u968e\u5c64\u306e\u3057\u304a\u308a\u60c5\u5831\u3092\u53d6\u5f97\u3057\u305f\u3044\u3068\u306e\u3053\u3068\u3067\u3001\u4e0b\u8a18\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3055\u308c\u305f\u3088\u3046\u3067\u3059\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=7244\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Acrobat-120x120.png' alt='PDF\u306e\u3057\u304a\u308a\u6570\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2016.08.31<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=7244\">PDF\u306e\u3057\u304a\u308a\u6570\u3092\u53d6\u5f97\u3059\u308bVBA\u30de\u30af\u30ed <\/a><\/div><div class=\"cardlink_excerpt\">\u300cVBA Acrobat \u3057\u304a\u308a\u6570\u300d\u3068\u3044\u3063\u305f\u30ad\u30fc\u30ef\u30fc\u30c9\u691c\u7d22\u3067\u306e\u30a2\u30af\u30bb\u30b9\u304c\u3042\u308a\u307e\u3057\u305f\u3002\r\nVBA\u304b\u3089PDF\u30d5\u30a1\u30a4\u30eb\u306b\u542b\u307e\u308c\u308b\u3057\u304a\u308a\u306e\u6570\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u3092\u63a2\u3057\u3066\u3044\u308b\u65b9\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u3002\r\n\r\n\r\nAcrobat JavaScript\u3067\u3057\u304a\u308a\u306e\u60c5\u5831\u3092\u53d6\u5f97\u3059\u308b\u5834\u5408\u3001Do...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<p>\u4e0a\u8a18\u8a18\u4e8b\u306e\u30b3\u30fc\u30c9\u306f\u4e00\u756a\u4e0a\u306e\u968e\u5c64\u306e\u3057\u304a\u308a\u3057\u304b\u60f3\u5b9a\u3057\u3066\u304a\u3089\u305a\u3001\u4e0b\u4f4d\u306e\u3057\u304a\u308a\u306e\u60c5\u5831\u306f\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u306e\u3067\u3001\u30b3\u30fc\u30c9\u3092\u4e00\u90e8\u4fee\u6b63\u3059\u308b\u5fc5\u8981\u304c\u6709\u308a\u307e\u3059\u3002<\/p>\n<p>Acrobat\u306e\u64cd\u4f5c\u3092\u884c\u3046\u969b\u3001\u6700\u3082\u53c2\u8003\u306b\u306a\u308b\u306e\u306f<a href=\"https:\/\/www.adobe.com\/devnet\/acrobat\/documentation.html\" title=\"Acrobat DC SDK Documentation\" target=\"_blank\" rel=\"noopener\">\u516c\u5f0f\u306e\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9<\/a>\u3067\u3059\u304c\u3001<a href=\"https:\/\/help.adobe.com\/en_US\/acrobat\/acrobat_dc_sdk\/2015\/HTMLHelp\/#t=Acro12_MasterBook%2FJS_API_AcroJS%2FBookmark_properties.htm\" title=\"Acrobat DC SDK Documentation\" target=\"_blank\" rel=\"noopener\">Bookmark\u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/a>\u306e\u30da\u30fc\u30b8\u3092\u898b\u3066\u307f\u308b\u3068\u3001\u4e0b\u8a18\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u304c\u8f09\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">function DumpBookmark(bkm, nLevel)\r\n{\r\n    var s = &quot;&quot;;\r\n    for (var i = 0; i &lt; nLevel; i++) s += &quot; &quot;;\r\n    console.println(s + &quot;+-&quot; + bkm.name);\r\n    if (bkm.children != null)\r\n        for (var i = 0; i &lt; bkm.children.length; i++)\r\n            DumpBookmark(bkm.children&#x5B;i], nLevel + 1);\r\n}\r\nconsole.clear();\r\nconsole.show();\r\nconsole.println(&quot;Dumping all bookmarks in the document.&quot;);\r\nDumpBookmark(this.bookmarkRoot, 0);<\/pre>\n<p>\u306a\u308b\u307b\u3069\u3002<br \/>\n\u518d\u5e30\u3067\u5217\u6319\u3057\u3066\u3044\u3051\u3070\u826f\u3044\u308f\u3051\u3067\u3059\u306d\uff01<\/p>\n<p>\u4e0a\u8a18\u30b5\u30f3\u30d7\u30eb\u3092\u53c2\u8003\u306b\u4fee\u6b63\u3057\u305f\u30b3\u30fc\u30c9\u304c\u4e0b\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n(\u76f8\u5909\u308f\u3089\u305aAcrobat\u306e\u30d7\u30ed\u30bb\u30b9\u304c\u6b8b\u308a\u7d9a\u3051\u3066\u3057\u307e\u3046\u554f\u984c\u304c\u767a\u751f\u3057\u3066\u3057\u307e\u3046\u3088\u3046\u3060\u3063\u305f\u306e\u3067\u3001\u5f37\u5236\u7d42\u4e86\u3059\u308b\u51e6\u7406\u3092\u5165\u308c\u3066\u3042\u308a\u307e\u3059\u3002)<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub Sample()\r\n  Dim app As Object 'AcroApp\r\n  Dim avdoc As Object 'AcroAVDoc\r\n  Dim avpv As Object 'AcroAVPageView\r\n  Dim jso As Object\r\n  Dim bkm As Object\r\n  Const PdfFilePath = &quot;C:\\Test\\\u30c6\u30b9\u30c8\u7528\u6587\u66f8(\u898b\u51fa\u3057).pdf&quot;\r\n   \r\n  Set app = CreateObject(&quot;AcroExch.App&quot;)\r\n  Set avdoc = CreateObject(&quot;AcroExch.AVDoc&quot;)\r\n  If avdoc.Open(PdfFilePath, &quot;&quot;) = True Then\r\n    app.Show '\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u8868\u793a\r\n    Set avpv = avdoc.GetAVPageView\r\n    Set jso = avdoc.GetPDDoc.GetJSObject\r\n    Set bkm = CallByName(jso, &quot;bookmarkRoot&quot;, VbGet)\r\n    DumpBookmark bkm, avpv\r\n    avdoc.Close 1\r\n    app.Hide: app.Exit\r\n  End If\r\n  TerminateAcrobat '\u30d7\u30ed\u30bb\u30b9\u304c\u6b8b\u3063\u305f\u5834\u5408\u5f37\u5236\u7d42\u4e86\r\nEnd Sub\r\n\r\nPrivate Sub DumpBookmark(ByVal bkm As Object, ByVal avpv As Object)\r\n'\u3057\u304a\u308a\u306e\u60c5\u5831\u3092\u51fa\u529b\r\n  Dim cld As Variant, cld2 As Variant\r\n  \r\n  On Error Resume Next\r\n  cld = CallByName(bkm, &quot;children&quot;, VbGet)\r\n  On Error GoTo 0\r\n  If IsEmpty(cld) = False Then\r\n    For Each cld2 In cld\r\n      CallByName cld2, &quot;execute&quot;, VbMethod '\u3057\u304a\u308a\u9078\u629e\r\n      Debug.Print &quot;\u540d\u524d\uff1a&quot; &amp; CallByName(cld2, &quot;name&quot;, VbGet) &amp; vbTab &amp; &quot;\u30da\u30fc\u30b8\uff1a&quot; &amp; avpv.GetPageNum + 1\r\n      DumpBookmark cld2, avpv\r\n    Next\r\n  End If\r\nEnd Sub\r\n\r\nPrivate Sub TerminateAcrobat()\r\n'Acrobat\u306e\u30d7\u30ed\u30bb\u30b9\u5f37\u5236\u7d42\u4e86\r\n  Dim items As Object\r\n  Dim item As Object\r\n   \r\n  Set items = CreateObject(&quot;WbemScripting.SWbemLocator&quot;) _\r\n            .ConnectServer.ExecQuery(&quot;Select * From Win32_Process Where Name = 'Acrobat.exe'&quot;)\r\n  If items.Count &gt; 0 Then\r\n    For Each item In items\r\n      item.Terminate\r\n    Next\r\n  End If\r\nEnd Sub<\/pre>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_DumpPdfBookmark_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_DumpPdfBookmark_01.jpg\" alt=\"\" width=\"882\" height=\"561\" class=\"alignnone size-full wp-image-13441\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_DumpPdfBookmark_01.jpg 882w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_DumpPdfBookmark_01-300x191.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/VBA_DumpPdfBookmark_01-768x488.jpg 768w\" sizes=\"auto, (max-width: 882px) 100vw, 882px\" \/><\/a><\/p>\n<p>\u7c21\u5358\u306a\u4fee\u6b63\u3067\u3059\u304c\u3001\u4e00\u5148\u305a\u3053\u308c\u3067PDF\u306e\u8907\u6570\u968e\u5c64\u306e\u3057\u304a\u308a\u60c5\u5831\u3092\u53d6\u5f97\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"Acrobat\u30d5\u30a9\u30fc\u30e9\u30e0\u306e\u4e0b\u8a18\u30b9\u30ec\u30c3\u30c9\u3067\u5f53\u30d6\u30ed\u30b0\u3078\u306e\u30ea\u30f3\u30af\u304c\u8cbc\u3089\u308c\u3066\u3044\u308b\u3053\u3068\u306b\u6c17\u304c\u4ed8\u304d\u307e\u3057\u305f\u3002 VBA\u3067PDF\u306e\u8907\u6570\u968e\u5c64\u306e\u3057\u304a\u308a\u60c5\u5831\u3092\u53d6\u5f97\u3057\u305f\u3044\u3068\u306e\u3053\u3068\u3067\u3001\u4e0b\u8a18\u8a18\u4e8b\u3092\u53c2\u8003\u306b\u3055\u308c\u305f\u3088\u3046\u3067\u3059\u3002 \u4e0a\u8a18\u8a18\u4e8b\u306e\u30b3\u30fc\u30c9\u306f\u4e00\u756a\u4e0a\u306e\u968e\u5c64 [&hellip;]","protected":false},"author":1,"featured_media":7108,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[PDF\u306e\u3057\u304a\u308a\u60c5\u5831\u3092\u51fa\u529b\u3059\u308bVBA\u30de\u30af\u30ed]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,48,136],"tags":[],"class_list":["post-13440","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-acrobat"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Acrobat.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-3uM","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/13440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=13440"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/13440\/revisions"}],"predecessor-version":[{"id":13442,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/13440\/revisions\/13442"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7108"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=13440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=13440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=13440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}