{"id":3427,"date":"2013-08-19T14:12:03","date_gmt":"2013-08-19T05:12:03","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=3427"},"modified":"2015-02-18T13:57:57","modified_gmt":"2015-02-18T04:57:57","slug":"%e5%8f%a4%e3%81%84%e5%bd%a2%e5%bc%8f%e3%81%aeword%e3%83%86%e3%83%b3%e3%83%97%e3%83%ac%e3%83%bc%e3%83%88%e3%82%92%e6%96%b0%e3%81%97%e3%81%84%e5%bd%a2%e5%bc%8f%e3%81%ab%e5%a4%89%e6%8f%9b%e3%81%99","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=3427","title":{"rendered":"\u53e4\u3044\u5f62\u5f0f\u306eWord\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3092\u65b0\u3057\u3044\u5f62\u5f0f\u306b\u4e00\u62ec\u5909\u63db\u3059\u308bVBScript"},"content":{"rendered":"<p>\u53e4\u3044\u5f62\u5f0f\u306eWord\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8(<span style=\"color: #ff0000; font-weight: bold;\">dot<\/span>)\u3092\u65b0\u3057\u3044\u5f62\u5f0f(<span style=\"color: #ff0000; font-weight: bold;\">dotx,dotm<\/span>)\u306b\u5909\u63db\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002<br \/>\nvbs\u30d5\u30a1\u30a4\u30eb\u306bdot\u5f62\u5f0f\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u30d5\u30a9\u30eb\u30c0\u30fc\u3092\u30c9\u30e9\u30c3\u30b0&#038;\u30c9\u30ed\u30c3\u30d7\u3059\u308b\u3068\u3001\u540c\u3058\u30d5\u30a9\u30eb\u30c0\u30fc\u5185\u306b\u65b0\u3057\u3044\u5f62\u5f0f\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b <a href=\"http:\/\/msdn.microsoft.com\/ja-jp\/library\/office\/ff845747.aspx\" title=\"Document.HasVBProject \u30d7\u30ed\u30d1\u30c6\u30a3 (Word)(\u6a5f\u68b0\u7ffb\u8a33)\" target=\"_blank\">Document\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306eHasVBProject\u30d7\u30ed\u30d1\u30c6\u30a3<\/a>\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u306e\u3067\u3001Word 2007\u4ee5\u524d\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3067\u306f\u52d5\u4f5c\u3057\u307e\u305b\u3093\u3002<\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nDim args\r\nDim fso\r\nDim itm\r\nDim target '\u51e6\u7406\u5bfe\u8c61\u30d5\u30a9\u30eb\u30c0\u30fc\u306e\u30d1\u30b9\r\n\r\nConst wdDoNotSaveChanges = 0\r\nConst wdFormatXMLTemplate = 14\r\nConst wdFormatXMLTemplateMacroEnabled = 15\r\n\r\nSet args = WScript.Arguments\r\nIf args.Count &lt; 1 Then\r\n  MsgBox &quot;dot\u30d5\u30a1\u30a4\u30eb\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u30d5\u30a9\u30eb\u30c0\u30fc\u3092&quot; &amp; vbCrLf &amp; _\r\n         &quot;\u5f53\u30b9\u30af\u30ea\u30d7\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u30c9\u30e9\u30c3\u30b0&amp;\u30c9\u30ed\u30c3\u30d7\u3057\u3066&quot; &amp; vbCrLf &amp; _\r\n         &quot;\u51e6\u7406\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;, 16 + 4096\r\n  WScript.Quit\r\nElseIf args.Count &gt; 1 Then\r\n  MsgBox &quot;\u5f53\u30b9\u30af\u30ea\u30d7\u30c8\u304c\u4e00\u5ea6\u306b\u51e6\u7406\u3067\u304d\u308b\u306e\u306f1\u30d5\u30a9\u30eb\u30c0\u30fc\u3060\u3051\u3067\u3059\u3002&quot; &amp; vbCrLf &amp; _\r\n         &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, 16 + 4096\r\n  WScript.Quit\r\nEnd If\r\n\r\nSet fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\nIf fso.FolderExists(args(0)) = False Then\r\n  MsgBox &quot;\u5bfe\u8c61\u30d5\u30a9\u30eb\u30c0\u30fc\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002&quot; &amp; vbCrLf &amp; _\r\n         &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, 16 + 4096\r\n  WScript.Quit\r\nEnd If\r\n\r\ntarget = args(0)\r\nIf Right(target, 1) &lt;&gt; ChrW(92) Then target = target &amp; ChrW(92)\r\nWith CreateObject(&quot;Word.Application&quot;)\r\n  .Visible = False\r\n  For Each itm In fso.GetFolder(target).Files\r\n    Select Case LCase(fso.GetExtensionName(itm.Path))\r\n      Case &quot;dot&quot;\r\n        With .Documents.Open(itm.Path, False, True, False)\r\n          If .HasVBProject Then\r\n            .SaveAs target &amp; fso.GetBaseName(itm.Path) &amp; &quot;.dotm&quot;, wdFormatXMLTemplateMacroEnabled\r\n          Else\r\n            .SaveAs target &amp; fso.GetBaseName(itm.Path) &amp; &quot;.dotx&quot;, wdFormatXMLTemplate\r\n          End If\r\n          .Close wdDoNotSaveChanges\r\n        End With\r\n    End Select\r\n  Next\r\n  .Quit wdDoNotSaveChanges\r\nEnd With\r\n\r\nMsgBox &quot;\u51e6\u7406\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002&quot;, 64 + 4096<\/pre>\n<h4>\u25a0 \u4f7f\u3044\u65b9<\/h4>\n<ol type=\"1\">\n<li>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u30b3\u30d4\u30fc\u3057\u3066\u30e1\u30e2\u5e33\u306b\u8cbc\u308a\u4ed8\u3051\u307e\u3059\u3002<\/li>\n<li>\u62e1\u5f35\u5b50\u3092\u300c<span style=\"color: #ff0000; font-weight: bold;\">vbs<\/span>\u300d\u306b\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/li>\n<li>\u624b\u98062.\u3067\u4fdd\u5b58\u3057\u305fvbs\u30d5\u30a1\u30a4\u30eb\u306b\u3001Word\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u30d5\u30a1\u30a4\u30eb(<span style=\"color: #ff0000; font-weight: bold;\">dot<\/span>)\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u30d5\u30a9\u30eb\u30c0\u30fc\u3092\u30c9\u30e9\u30c3\u30b0&#038;\u30c9\u30ed\u30c3\u30d7\u3057\u307e\u3059\u3002<\/li>\n<\/ol>\n<h4>\u25a0 \u95a2\u9023\u8a18\u4e8b<\/h4>\n<p><strong>\u30fbOffice\u6587\u66f8\u3092\u65e7\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306b\u5909\u63db\u3059\u308bVBScript<\/strong><br \/>\n<a href=\"\/\/www.ka-net.org\/blog\/?p=3828\" title=\"Office\u6587\u66f8\u3092\u65e7\u30d0\u30fc\u30b8\u30e7\u30f3\u306e\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u306b\u5909\u63db\u3059\u308bVBScript | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">\/\/www.ka-net.org\/blog\/?p=3828<\/a><br \/>\n<strong>\u30fb\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u3067Excel\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c9\u30a4\u30f3\u5f62\u5f0f(xlam)\u306b\u4e00\u62ec\u5909\u63db\u3059\u308bVBScript<\/strong><br \/>\n<a href=\"\/\/www.ka-net.org\/blog\/?p=5264\" title=\"\u30c9\u30e9\u30c3\u30b0\uff06\u30c9\u30ed\u30c3\u30d7\u3067Excel\u30d5\u30a1\u30a4\u30eb\u3092\u30a2\u30c9\u30a4\u30f3\u5f62\u5f0f(xlam)\u306b\u4e00\u62ec\u5909\u63db\u3059\u308bVBScript | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">\/\/www.ka-net.org\/blog\/?p=5264<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\u53e4\u3044\u5f62\u5f0f\u306eWord\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8(dot)\u3092\u65b0\u3057\u3044\u5f62\u5f0f(dotx,dotm)\u306b\u5909\u63db\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\u3057\u307e\u3057\u305f\u3002 vbs\u30d5\u30a1\u30a4\u30eb\u306bdot\u5f62\u5f0f\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u304c\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u30d5\u30a9\u30eb\u30c0\u30fc\u3092\u30c9\u30e9\u30c3\u30b0&#038;\u30c9\u30ed\u30c3\u30d7\u3059\u308b\u3068\u3001\u540c\u3058 [&hellip;]","protected":false},"author":1,"featured_media":7134,"comment_status":"open","ping_status":"open","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,49,6],"tags":[],"class_list":["post-3427","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-word-office","category-vbs"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Word.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-Th","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3427","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=3427"}],"version-history":[{"count":6,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3427\/revisions"}],"predecessor-version":[{"id":5266,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/3427\/revisions\/5266"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7134"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3427"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3427"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}