{"id":6209,"date":"2015-09-17T16:31:08","date_gmt":"2015-09-17T07:31:08","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=6209"},"modified":"2019-08-16T14:00:32","modified_gmt":"2019-08-16T05:00:32","slug":"%e3%83%91%e3%82%b9%e3%83%af%e3%83%bc%e3%83%89%e4%bb%98%e3%81%aepdf%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e4%bd%9c%e6%88%90%e3%81%99%e3%82%8bexcel%e3%83%9e%e3%82%af%e3%83%ad","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=6209","title":{"rendered":"\u30d1\u30b9\u30ef\u30fc\u30c9\u4ed8\u306ePDF\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308bExcel\u30de\u30af\u30ed"},"content":{"rendered":"<p><span style=\"color: #ff0000; font-weight: bold;\">2019\/8\/16 \u8ffd\u8a18\uff1a<\/span><br \/>\nWord\u3084PowerPoint\u306b\u3082\u5bfe\u5fdc\u3057\u305f\u3001\u6539\u826f\u7248\u306e\u30de\u30af\u30ed\u306b\u3064\u3066\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=12120\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-OfficeVBA-120x120.png' alt='Office\u6587\u66f8\u3092\u30d1\u30b9\u30ef\u30fc\u30c9\u4ed8\u304dPDF\u306b\u5909\u63db\u3059\u308bVBA\u30de\u30af\u30ed' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2019.08.16<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=12120\">Office\u6587\u66f8\u3092\u30d1\u30b9\u30ef\u30fc\u30c9\u4ed8\u304dPDF\u306b\u5909\u63db\u3059\u308bVBA\u30de\u30af\u30ed <\/a><\/div><div class=\"cardlink_excerpt\">4\u5e74\u307b\u3069\u524d\u306b\u66f8\u3044\u305f\u3001\u4e0b\u8a18\u8a18\u4e8b\u306e\u30de\u30af\u30ed\u304cWord\u3067\u3082\u4f7f\u3048\u308b\u304b\uff1f\u3068\u306e\u8cea\u554f\u3092\u9802\u304d\u307e\u3057\u305f\u3002\r\n\r\n\r\n\r\n\u6b8b\u5ff5\u306a\u304c\u3089\u3001\u4e0a\u8a18\u8a18\u4e8b\u306e\u30b3\u30fc\u30c9\u3092Word\u3067\u305d\u306e\u307e\u307e\u4f7f\u3046\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002\r\n\u305d\u3053\u3067\u4eca\u56de\u306f\u3001Excel\u306b\u9650\u5b9a\u305b\u305a\u3001Word\u3084PowerPoint\u30d5\u30a1\u30a4\u30eb\u306b\u3082\u5bfe\u5fdc\u3057\u305f\u30de...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<hr \/>\n<p>\u4ee5\u524d\u66f8\u3044\u305f\u30de\u30af\u30ed\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002<br \/>\nAcrobat\u4ed8\u5c5e\u306eOffice\u7528COM\u30a2\u30c9\u30a4\u30f3\u300c<span style=\"color: #ff0000; font-weight: bold;\">Acrobat PDFMaker Office COM Addin<\/span>\u300d\u3092\u5229\u7528\u3057\u3066\u3001Excel\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u30d1\u30b9\u30ef\u30fc\u30c9(\u8aad\u307f\u53d6\u308a\u3001\u66f8\u304d\u8fbc\u307f)\u4ed8\u306ePDF\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db\u3059\u308b\u30de\u30af\u30ed\u3067\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub Sample()\r\n  ConvertPdfUsingPDFMaker &quot;C:\\Test\\\u30c6\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb.xlsx&quot;, _\r\n                          &quot;C:\\Test\\\u5909\u63db\u5f8c.pdf&quot;, _\r\n                          &quot;read&quot;, _\r\n                          &quot;write&quot;\r\nEnd Sub\r\n\r\nPublic Sub ConvertPdfUsingPDFMaker(ByVal InputFilePath As String, _\r\n                                   ByVal OutputFilePath As String, _\r\n                                   Optional ByVal ReadPassWord As String = &quot;&quot;, _\r\n                                   Optional ByVal WritePassWord As String = &quot;&quot;)\r\n'&#x5B;Acrobat PDFMaker Office COM Addin]\u3092\u4f7f\u3063\u3066PDF\u30d5\u30a1\u30a4\u30eb\u306b\u5909\u63db(Excel)\r\n'\u4e0b\u8a18\u30e9\u30a4\u30d6\u30e9\u30ea\u8981\u53c2\u7167\r\n' - AdobePDFMakerForOffice(AcrobatPDFMakerForOffice.tlb)\r\n' - PDFMakerAPI 1.0 Type Library(PDFMakerAPI.dll)\r\n  Dim pm As AdobePDFMakerForOffice.PDFMaker\r\n  Dim iset As AdobePDFMakerForOffice.ISettings\r\n  Dim sset As PDFMAKERAPILib.SecuritySettings\r\n  Dim wb As Excel.Workbook\r\n  \r\n  Set pm = GetPDFMaker()\r\n  If pm Is Nothing Then\r\n    MsgBox &quot;&#x5B;Acrobat PDFMaker Office COM Addin]\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot; &amp; vbNewLine &amp; _\r\n           &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbExclamation + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  \r\n  Set wb = Application.Workbooks.Open(InputFilePath)\r\n  wb.Activate '\u5ff5\u306e\u305f\u3081\u958b\u3044\u305f\u30d6\u30c3\u30af\u3092\u30a2\u30af\u30c6\u30a3\u30d6\u306b\u3059\u308b\r\n  \r\n  '\u74b0\u5883\u8a2d\u5b9a(\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u30aa\u30d7\u30b7\u30e7\u30f3\u5909\u66f4)\r\n  pm.GetCurrentConversionSettings iset\r\n  With iset\r\n    .IsAutomation = True\r\n    .IsConversionSilent = True\r\n    .ShouldShowProgressDialog = True\r\n    .ViewPDFFile = False '\u7d50\u679c\u306e Adobe PDF \u3092\u8868\u793a(False\u3067\u975e\u8868\u793a)\r\n    .PrintActivesheetOnly = False '\u5909\u63db\u7bc4\u56f2(False\u3067\u30d6\u30c3\u30af\u5168\u4f53)\r\n    .PromptForPDFFilename = False\r\n    .PromptForSheetSelection = False\r\n    .OutputPDFFileName = OutputFilePath\r\n  End With\r\n  \r\n  '\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u8a2d\u5b9a\r\n  If Len(Trim(ReadPassWord)) &gt; 0 Or _\r\n     Len(Trim(WritePassWord)) &gt; 0 Then\r\n    Set sset = New PDFMAKERAPILib.SecuritySettings\r\n    With sset\r\n      If Len(Trim(ReadPassWord)) &gt; 0 Then\r\n      '\u6587\u66f8\u3092\u958b\u304f\u3068\u304d\u306e\u30d1\u30b9\u30ef\u30fc\u30c9\u8a2d\u5b9a\r\n        .OpenDocPasswdNeeded = True\r\n        .OpenDocPasswd = ReadPassWord\r\n      End If\r\n      \r\n      If Len(Trim(WritePassWord)) &gt; 0 Then\r\n      '\u6a29\u9650\u8a2d\u5b9a\r\n        .PermsPasswdNeeded = True\r\n        .PermsPasswd = WritePassWord\r\n        \r\n        '\u5370\u5237\u3092\u8a31\u53ef\r\n        '.PrintingModeAllowed = kPrintingAllowedHighRes '\u9ad8\u89e3\u50cf\u5ea6\r\n        '.PrintingModeAllowed = kPrintingAllowedLowRes '\u4f4e\u89e3\u50cf\u5ea6 (150 dpi)\r\n        .PrintingModeAllowed = kPrintingAllowedNone '\u8a31\u53ef\u3057\u306a\u3044\r\n        \r\n        '\u5909\u66f4\u3092\u8a31\u53ef\r\n        '.AllowedChanges = kAllowChangesAnyExceptPageExtraction '\u30da\u30fc\u30b8\u306e\u62bd\u51fa\u3092\u9664\u304f\u3059\u3079\u3066\u306e\u64cd\u4f5c\r\n        '.AllowedChanges = kAllowChangesCommentingFormfillsSign '\u6ce8\u91c8\u306e\u4f5c\u6210\u3001\u30d5\u30a9\u30fc\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5165\u529b\u3068\u65e2\u5b58\u306e\u7f72\u540d\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u7f72\u540d\r\n        '.AllowedChanges = kAllowChangesFormfillsSign '\u30d5\u30a9\u30fc\u30e0\u30d5\u30a3\u30fc\u30eb\u30c9\u306e\u5165\u529b\u3068\u65e2\u5b58\u306e\u7f72\u540d\u30d5\u30a3\u30fc\u30eb\u30c9\u306b\u7f72\u540d\r\n        '.AllowedChanges = kAllowChangesInsertDeleteRotatePages '\u30da\u30fc\u30b8\u306e\u633f\u5165\u3001\u524a\u9664\u3001\u56de\u8ee2\r\n        .AllowedChanges = kAllowChangesNone '\u8a31\u53ef\u3057\u306a\u3044\r\n        \r\n        '\u30c6\u30ad\u30b9\u30c8\u3001\u753b\u50cf\u3001\u304a\u3088\u3073\u305d\u306e\u4ed6\u306e\u5185\u5bb9\u306e\u30b3\u30d4\u30fc\u3092\u6709\u52b9\u306b\u3059\u308b\r\n        '.EnableCopyingContent = True 'True:\u30c1\u30a7\u30c3\u30afON \/ False:\u30c1\u30a7\u30c3\u30afOFF\r\n      End If\r\n    End With\r\n    iset.SecuritySettings = sset\r\n  End If\r\n  \r\n  pm.CreatePDFEx iset, 0 'PDF\u4f5c\u6210\r\n  wb.Close SaveChanges:=False\r\nEnd Sub\r\n\r\nPrivate Function GetPDFMaker() As AdobePDFMakerForOffice.PDFMaker\r\n'PDFMaker\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u53d6\u5f97\r\n  Dim ad As Office.COMAddIn\r\n  Dim ret As AdobePDFMakerForOffice.PDFMaker\r\n  \r\n  Set ret = Nothing '\u521d\u671f\u5316\r\n  For Each ad In Application.COMAddIns\r\n    If ad.Connect = True Then\r\n      If LCase(ad.progID) = LCase(&quot;PDFMaker.OfficeAddin&quot;) Then\r\n        Set ret = ad.Object\r\n        Exit For\r\n      End If\r\n    End If\r\n  Next\r\n  Set GetPDFMaker = ret\r\nEnd Function<\/pre>\n<p>\u30b3\u30fc\u30c9\u4e2d\u306b\u3082\u8a18\u8f09\u3057\u3066\u3044\u307e\u3059\u304c\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">AdobePDFMakerForOffice(AcrobatPDFMakerForOffice.tlb)<\/span>\u300d\u3068\u300c<span style=\"color: #ff0000; font-weight: bold;\">PDFMakerAPI 1.0 Type Library(PDFMakerAPI.dll)<\/span>\u300d\u306e\u53c2\u7167\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>\u305f\u3057\u304b\u3001\u201ckPrintingAllowedHighRes\u201d\u3068\u304b\u201ckAllowChangesCommentingFormfillsSign\u201d\u3068\u3044\u3063\u305f\u5024\u304c\u4f55\u3092\u6307\u3057\u3066\u3044\u308b\u306e\u304b\u3092\u8abf\u3079\u308b\u306e\u304c\u5927\u5909\u3067\u653e\u7f6e\u3057\u305f\u307e\u307e\u306b\u306a\u3063\u3066\u3044\u305f\u306e\u3067\u3057\u305f\u3002<\/p>\n<p>\u7d50\u5c40\u4eca\u306b\u306a\u3063\u3066\u3082\u8abf\u3079\u304d\u308c\u3066\u3044\u307e\u305b\u3093\u3002<br \/>\nUIA\u3067\u30a2\u30c9\u30a4\u30f3\u306e\u30c0\u30a4\u30a2\u30ed\u30b0\u64cd\u4f5c\u3057\u305f\u65b9\u304c\u30de\u30b7\u304b\u3082\uff1f\u3001\u306a\u3093\u3066\u601d\u3044\u3082\u3057\u307e\u3059\u304c\u3001\u3044\u3064\u304b\u3069\u3053\u304b\u3067\u4f7f\u3046\u6a5f\u4f1a\u304c\u3042\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u306e\u3067\u3001\u4e00\u5fdc\u6b8b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"2019\/8\/16 \u8ffd\u8a18\uff1a Word\u3084PowerPoint\u306b\u3082\u5bfe\u5fdc\u3057\u305f\u3001\u6539\u826f\u7248\u306e\u30de\u30af\u30ed\u306b\u3064\u3066\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3057\u305f\u3002 \u4ee5\u524d\u66f8\u3044\u305f\u30de\u30af\u30ed\u304c\u51fa\u3066\u304d\u307e\u3057\u305f\u3002 Acrobat\u4ed8\u5c5e\u306eOffice\u7528COM\u30a2\u30c9\u30a4\u30f3\u300cAcrobat PDFM [&hellip;]","protected":false},"author":1,"featured_media":7111,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,48],"tags":[],"class_list":["post-6209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1C9","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6209","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=6209"}],"version-history":[{"count":3,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6209\/revisions"}],"predecessor-version":[{"id":12123,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6209\/revisions\/12123"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7111"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}