{"id":5087,"date":"2014-11-25T16:39:40","date_gmt":"2014-11-25T07:39:40","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=5087"},"modified":"2014-11-25T16:43:28","modified_gmt":"2014-11-25T07:43:28","slug":"%e3%83%95%e3%82%a9%e3%83%ab%e3%83%80%e5%86%85%e3%81%ab%e3%81%82%e3%82%8bexcel%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e3%82%ab%e3%82%a6%e3%83%b3%e3%83%88%e3%81%99%e3%82%8bvbscript","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=5087","title":{"rendered":"\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u3042\u308bExcel\u30d5\u30a1\u30a4\u30eb\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308bVBScript"},"content":{"rendered":"<p>\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u30d5\u30a9\u30eb\u30c0\u5185 Excel \u6570\u3048\u308b VBScript<\/span>\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<\/p>\n<p>\u6050\u3089\u304f\u6307\u5b9a\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u3042\u308bExcel\u30d5\u30a1\u30a4\u30eb\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u3053\u3068\u304c\u76ee\u7684\u3060\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306e\u7c21\u5358\u306a\u51e6\u7406\u3092\u8003\u3048\u3066\u307f\u307e\u3057\u305f\u3002<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b \u4e0b\u8a18\u30b3\u30fc\u30c9\u306f\u30b5\u30d6\u30d5\u30a9\u30eb\u30c0\u5185\u306eExcel\u30d5\u30a1\u30a4\u30eb\u306f\u30ab\u30a6\u30f3\u30c8\u3057\u307e\u305b\u3093\u3002<\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nDim args\r\nDim f\r\nDim cntXls  'Excel 97-2003 \u30d6\u30c3\u30af (*.xls)\r\nDim cntXlsx 'Excel \u30d6\u30c3\u30af (*.xlsx)\r\nDim cntXlsm 'Excel \u30de\u30af\u30ed\u6709\u52b9\u30d6\u30c3\u30af (*.xlsm)\r\nDim cntXlsb 'Excel \u30d0\u30a4\u30ca\u30ea \u30d6\u30c3\u30af (*.xlsb)\r\nDim cntXlt  'Excel 97-2003 \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 (*.xlt)\r\nDim cntXltx 'Excel \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 (*.xltx)\r\nDim cntXltm 'Excel \u30de\u30af\u30ed\u6709\u52b9\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 (*.xltm)\r\nDim cntXla  'Excel 97-2003 \u30a2\u30c9\u30a4\u30f3 (*.xla)\r\nDim cntXlam 'Excel \u30a2\u30c9\u30a4\u30f3 (*.xlam)\r\nDim cntCsv  'CSV (*.csv)\r\n\r\n'\u521d\u671f\u5316\r\ncntXls = 0\r\ncntXlsx = 0\r\ncntXlsm = 0\r\ncntXlsb = 0\r\ncntXlt = 0\r\ncntXltx = 0\r\ncntXltm = 0\r\ncntXla = 0\r\ncntXlam = 0\r\ncntCsv = 0\r\n\r\nSet args = WScript.Arguments\r\n'\u30d1\u30e9\u30e1\u30fc\u30bf\u6570\u30c1\u30a7\u30c3\u30af\r\nIf args.Count &lt; 1 Then\r\n  WScript.Echo &quot;\u5f53\u30b9\u30af\u30ea\u30d7\u30c8\u306b\u30d5\u30a9\u30eb\u30c0\u3092\u30c9\u30e9\u30c3\u30b0&amp;\u30c9\u30ed\u30c3\u30d7\u3057\u3066\u51e6\u7406\u3092\u5b9f\u884c\u3057\u3066\u304f\u3060\u3055\u3044\u3002&quot;\r\n  WScript.Quit\r\nEnd If\r\n\r\nWith CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\n  If Not .FolderExists(args(0)) Then\r\n    WScript.Echo &quot;\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002&quot; &amp; vbCrLf &amp; &quot;\u3042\u308b\u3044\u306f\u30d5\u30a9\u30eb\u30c0\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002&quot;\r\n    WScript.Quit\r\n  Else\r\n    For Each f In .GetFolder(args(0)).Files\r\n      Select Case LCase(.GetExtensionName(f.Path))\r\n        Case &quot;xls&quot;:  cntXls = cntXls + 1\r\n        Case &quot;xlsx&quot;: cntXlsx = cntXlsx + 1\r\n        Case &quot;xlsm&quot;: cntXlsm = cntXlsm + 1\r\n        Case &quot;xlsb&quot;: cntXlsb = cntXlsb + 1\r\n        Case &quot;xlt&quot;:  cntXlt = cntXlt + 1\r\n        Case &quot;xltx&quot;: cntXltx = cntXltx + 1\r\n        Case &quot;xltm&quot;: cntXltm = cntXltm + 1\r\n        Case &quot;xla&quot;:  cntXla = cntXla + 1\r\n        Case &quot;xlam&quot;: cntXlam = cntXlam + 1\r\n        Case &quot;csv&quot;:  cntCsv = cntCsv + 1\r\n      End Select\r\n    Next\r\n  End If\r\nEnd With\r\n\r\nWScript.Echo &quot;&#x5B;&quot; &amp; args(0) &amp; &quot;]\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u3042\u308bExcel\u30d5\u30a1\u30a4\u30eb\u6570\u306f\u4e0b\u8a18\u306e\u901a\u308a\u3067\u3059\u3002&quot; &amp; vbCrLf &amp; vbCrLf &amp; _\r\n             &quot;Excel 97-2003 \u30d6\u30c3\u30af (*.xls)\uff1a&quot; &amp; cntXls &amp; vbCrLf &amp; _\r\n             &quot;Excel \u30d6\u30c3\u30af (*.xlsx)\uff1a&quot; &amp; cntXlsx &amp; vbCrLf &amp; _\r\n             &quot;Excel \u30de\u30af\u30ed\u6709\u52b9\u30d6\u30c3\u30af (*.xlsm)\uff1a&quot; &amp; cntXlsm &amp; vbCrLf &amp; _\r\n             &quot;Excel \u30d0\u30a4\u30ca\u30ea \u30d6\u30c3\u30af (*.xlsb)\uff1a&quot; &amp; cntXlsb &amp; vbCrLf &amp; _\r\n             &quot;Excel 97-2003 \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 (*.xlt)\uff1a&quot; &amp; cntXlt &amp; vbCrLf &amp; _\r\n             &quot;Excel \u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 (*.xltx)\uff1a&quot; &amp; cntXltx &amp; vbCrLf &amp; _\r\n             &quot;Excel \u30de\u30af\u30ed\u6709\u52b9\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8 (*.xltm)\uff1a&quot; &amp; cntXltm &amp; vbCrLf &amp; _\r\n             &quot;Excel 97-2003 \u30a2\u30c9\u30a4\u30f3 (*.xla)\uff1a&quot; &amp; cntXla &amp; vbCrLf &amp; _\r\n             &quot;Excel \u30a2\u30c9\u30a4\u30f3 (*.xlam)\uff1a&quot; &amp; cntXlam &amp; vbCrLf &amp; _\r\n             &quot;CSV (*.csv)\uff1a&quot; &amp; cntCsv<\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u300c<span style=\"color: #ff0000; font-weight: bold;\">vbs<\/span>\u300d\u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4fdd\u5b58\u3057\u3001\u305d\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u5bfe\u8c61\u3068\u306a\u308b\u30d5\u30a9\u30eb\u30c0\u3092\u30c9\u30e9\u30c3\u30b0&#038;\u30c9\u30ed\u30c3\u30d7\u3059\u308b\u3068\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306bExcel\u30d5\u30a1\u30a4\u30eb\u3092\u30ab\u30a6\u30f3\u30c8\u3057\u305f\u7d50\u679c\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CountExcelFiles_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CountExcelFiles_01.jpg\" alt=\"CountExcelFiles_01\" width=\"489\" height=\"394\" class=\"alignnone size-full wp-image-5088\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CountExcelFiles_01.jpg 489w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CountExcelFiles_01-300x241.jpg 300w\" sizes=\"auto, (max-width: 489px) 100vw, 489px\" \/><\/a><\/p>\n<p>\u9700\u8981\u304c\u3042\u308b\u306e\u304b\u3069\u3046\u304b\u306f\u5206\u304b\u308a\u307e\u305b\u3093\u304c\u3001\u5927\u91cf\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u3067\u3001Excel\u30d5\u30a1\u30a4\u30eb\u304c\u3069\u306e\u4f4d\u3042\u308b\u306e\u304b\u77e5\u308a\u305f\u3044\u5834\u5408\u306b\u306f\u4f7f\u3048\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u300c\u30d5\u30a9\u30eb\u30c0\u5185 Excel \u6570\u3048\u308b VBScript\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 \u6050\u3089\u304f\u6307\u5b9a\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u3042\u308bExcel\u30d5\u30a1\u30a4\u30eb\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308b\u3053\u3068\u304c\u76ee\u7684\u3060\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u3067\u306e\u7c21\u5358\u306a\u51e6\u7406\u3092\u8003\u3048 [&hellip;]","protected":false},"author":1,"featured_media":7111,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"\u5927\u91cf\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u3067\u3001Excel\u30d5\u30a1\u30a4\u30eb\u304c\u3069\u306e\u4f4d\u3042\u308b\u306e\u304b\u77e5\u308a\u305f\u3044\u5834\u5408\u306b\u306f\u4f7f\u3048\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3082\uff1f [\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u3042\u308bExcel\u30d5\u30a1\u30a4\u30eb\u3092\u30ab\u30a6\u30f3\u30c8\u3059\u308bVBScript]","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":[48,6],"tags":[],"class_list":["post-5087","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-excel-office","category-vbs"],"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-1k3","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5087","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=5087"}],"version-history":[{"count":2,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5087\/revisions"}],"predecessor-version":[{"id":5090,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5087\/revisions\/5090"}],"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=5087"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5087"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5087"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}