{"id":3858,"date":"2022-12-26T22:30:49","date_gmt":"2022-12-26T13:30:49","guid":{"rendered":"https:\/\/www.bold.ne.jp\/engineer-club\/?p=3858"},"modified":"2025-11-19T10:49:39","modified_gmt":"2025-11-19T01:49:39","slug":"vba-dir","status":"publish","type":"post","link":"https:\/\/www.bold.ne.jp\/engineer-club\/vba-dir","title":{"rendered":"VBA\u306eDir\u95a2\u6570\u3068\u306f\uff1f\u95a2\u6570\u306e\u89e3\u8aac\u3068\u4f7f\u7528\u4f8b"},"content":{"rendered":"<p>Dir\u95a2\u6570\u306f\u3001\u300c<strong><span class=\"f-marker-p\">\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b\u6307\u5b9a\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u304b<\/span><\/strong>\u300d\u3084\u300c<strong><span class=\"f-marker-p\">\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306b\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u3084\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u53d6\u5f97\u3057\u305f\u3044<\/span><\/strong>\u300d\u6642\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<div id=\"toc_container\" class=\"no_bullets\"><p class=\"toc_title\">\u76ee\u6b21<\/p><ul class=\"toc_list\"><li><a href=\"#VBADir\">\uff11\uff0eVBA\u306eDir\u95a2\u6570\u306b\u3064\u3044\u3066<\/a><ul><li><a href=\"#-Dir\">\uff11-\uff11\uff0eDir\u95a2\u6570\u3068\u306f<\/a><\/li><li><a href=\"#-Dir-2\">\uff11-\uff12\uff0eDir\u95a2\u6570\u306e\u69cb\u6587<\/a><\/li><\/ul><\/li><li><a href=\"#VBA_Dir\">\uff12\uff0eVBA Dir\u95a2\u6570\u306e\u4f7f\u7528\u4f8b<\/a><ul><li><a href=\"#i\">\uff12-\uff11\uff0e\u57fa\u672c\u7684\u306a\u4f7f\u7528\u4f8b<\/a><\/li><li><a href=\"#i-2\">\uff12-\uff12\uff0e\u305d\u306e\u4ed6\u306e\u4f7f\u7528\u4f8b<\/a><\/li><\/ul><\/li><li><a href=\"#VBA_Dir-2\">\uff13\uff0eVBA Dir\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u6ce8\u610f\u70b9<\/a><ul><li><a href=\"#-attributes256\">\uff13-\uff11\uff0e\u5f15\u6570\u306eattributes\u306b\u8a2d\u5b9a\u3059\u308b\u6587\u5b57\u5217\u304c256\u6587\u5b57\u8d85<\/a><\/li><li><a href=\"#i-3\">\uff13-\uff12\uff0e\u62e1\u5f35\u5b50\u304c\u4f3c\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u5834\u5408<\/a><\/li><\/ul><\/li><li><a href=\"#i-4\">\uff14\uff0e\u6700\u5f8c\u306b<\/a><\/li><\/ul><\/div>\n<h2><span id=\"VBADir\">\uff11\uff0eVBA\u306eDir\u95a2\u6570\u306b\u3064\u3044\u3066<\/span><\/h2>\n<h3><span id=\"-Dir\"><span>\uff11-\uff11\uff0eDir<\/span>\u95a2\u6570\u3068\u306f<\/span><\/h3>\n<p>\u6307\u5b9a\u3057\u305f\u6761\u4ef6\uff08\u30d1\u30bf\u30fc\u30f3\u3001\u30d5\u30a1\u30a4\u30eb\u5c5e\u6027\uff09\u306b\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u307e\u305f\u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3001\u30d5\u30a9\u30eb\u30c0\u540d\u3001\u307e\u305f\u306f\u30c9\u30e9\u30a4\u30d6\u306e\u30dc\u30ea\u30e5\u30fc\u30e0\u30e9\u30d9\u30eb\u3092<span>String<\/span>\u578b\u3067\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<h3><span id=\"-Dir-2\"><span>\uff11-\uff12\uff0eDir<\/span>\u95a2\u6570\u306e\u69cb\u6587<\/span><\/h3>\n<pre class=\"prettyprint lang:default decode:true\">Dir [pathname] [attributes]<\/pre>\n<h4>\uff11-\uff12-\uff11\uff0e\u5f15\u6570<span>pathname<\/span><\/h4>\n<p>\u7701\u7565\u53ef\u80fd\u3002\u30d5\u30a1\u30a4\u30eb\u540d\u3001\u30d5\u30a9\u30eb\u30c0\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u307f\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306f\u3001\u9577\u3055<span>0<\/span>\u306e\u6587\u5b57\u5217\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<h4><span>\uff11-\uff12-\uff12\uff0e<\/span>\u5f15\u6570<span>attributes<\/span><\/h4>\n<p>\u7701\u7565\u53ef\u80fd\u3002\u7701\u7565\u3057\u305f\u5834\u5408\u306f\u3001<span>pathname<\/span>\u3068\u540c\u3058\u5c5e\u6027\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u8fd4\u3057\u307e\u3059\u3002\u4e0b\u8a18\u8868\u306b\u3042\u308b\u30d5\u30a1\u30a4\u30eb\u5c5e\u6027\u3092\u6307\u5b9a\u3059\u308b\u5b9a\u6570\u304b\u5024\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<table style=\"border-collapse: collapse; width: 100%; height: 192px;\">\n<tbody>\n<tr style=\"height: 24px;\">\n<td style=\"width: 21.4712%; height: 24px;\">\u5b9a\u6570\u540d<\/td>\n<td style=\"width: 12.9196%; height: 24px;\">\u5024<\/td>\n<td style=\"width: 65.6091%; height: 24px;\">\u8aac\u660e<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 21.4712%; height: 24px;\">vbNormal<\/td>\n<td style=\"width: 12.9196%; height: 24px;\">0<\/td>\n<td style=\"width: 65.6091%; height: 24px;\">\u5c5e\u6027\u306e\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3002<br \/>\n\u7701\u7565\u3057\u305f\u5834\u5408\u306f\u3001\u81ea\u52d5\u7684\u306b\u3053\u306e\u8a2d\u5b9a\u306b\u306a\u308a\u307e\u3059\u3002<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 21.4712%; height: 24px;\">vbReadOnly<\/td>\n<td style=\"width: 12.9196%; height: 24px;\">1<\/td>\n<td style=\"width: 65.6091%; height: 24px;\">\u5c5e\u6027\u306e\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3068\u8aad\u307f\u53d6\u308a\u5c02\u7528\u306e\u30d5\u30a1\u30a4\u30eb\u3002<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 21.4712%; height: 24px;\">vbHidden<\/td>\n<td style=\"width: 12.9196%; height: 24px;\">2<\/td>\n<td style=\"width: 65.6091%; height: 24px;\">\u5c5e\u6027\u306e\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3068\u96a0\u3057\u30d5\u30a1\u30a4\u30eb\u3002<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 21.4712%; height: 24px;\">vbSystem<\/td>\n<td style=\"width: 12.9196%; height: 24px;\">4<\/td>\n<td style=\"width: 65.6091%; height: 24px;\">\u5c5e\u6027\u306e\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3068\u30b7\u30b9\u30c6\u30e0 \u30d5\u30a1\u30a4\u30eb\u3002<br \/>\nMacintosh \u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 21.4712%; height: 24px;\">vbVolume<\/td>\n<td style=\"width: 12.9196%; height: 24px;\">8<\/td>\n<td style=\"width: 65.6091%; height: 24px;\">\u30dc\u30ea\u30e5\u30fc\u30e0 \u30e9\u30d9\u30eb<br \/>\n\u4ed6\u306e\u5c5e\u6027\u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u306f\u3001<span>vbVolume\u00a0<\/span>\u306f\u7121\u8996\u3002<br \/>\nMacintosh \u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 21.4712%; height: 24px;\">vbDirectory<\/td>\n<td style=\"width: 12.9196%; height: 24px;\">16<\/td>\n<td style=\"width: 65.6091%; height: 24px;\">\u5c5e\u6027\u306e\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u3068\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u307e\u305f\u306f\u30d5\u30a9\u30eb\u30c0\u3002<\/td>\n<\/tr>\n<tr style=\"height: 24px;\">\n<td style=\"width: 21.4712%; height: 24px;\">vbAlias<\/td>\n<td style=\"width: 12.9196%; height: 24px;\">64<\/td>\n<td style=\"width: 65.6091%; height: 24px;\">\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u306f\u30a8\u30a4\u30ea\u30a2\u30b9\u3002<br \/>\nMacintosh \u3067\u306e\u307f\u4f7f\u7528\u53ef\u80fd\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u203b\uff1a\u5c5e\u6027\u3068\u306f\u3001\u300c\u8aad\u307f\u53d6\u308a\u5c02\u7528\u300d\u300c\u30b7\u30b9\u30c6\u30e0\u30d5\u30a1\u30a4\u30eb\u300d\u300c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u300d\u300c\u96a0\u3057\u5c5e\u6027\u300d\u7b49\u306e\u3053\u3068\u3067\u3059\u3002<\/p>\n<h2><span id=\"VBA_Dir\">\uff12\uff0eVBA Dir\u95a2\u6570\u306e\u4f7f\u7528\u4f8b<\/span><\/h2>\n<h3><span id=\"i\">\uff12-\uff11\uff0e\u57fa\u672c\u7684\u306a\u4f7f\u7528\u4f8b<\/span><\/h3>\n<p><span>C<\/span>\u30c9\u30e9\u30a4\u30d6\u76f4\u4e0b\u306b\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210\u304c\u3042\u308b\u3068\u304d\u3001<span>C<\/span>\u30c9\u30e9\u30a4\u30d6\u76f4\u4e0b\u3067\u5b9f\u884c\u3057\u305f\u4f8b\u3092\u8a18\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/C\u30c9\u30e9\u30a4\u30d6\u76f4\u4e0b\u3067\u5b9f\u884c\u3057\u305f\u4f8b.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/C\u30c9\u30e9\u30a4\u30d6\u76f4\u4e0b\u3067\u5b9f\u884c\u3057\u305f\u4f8b.png\" alt=\"C\u30c9\u30e9\u30a4\u30d6\u76f4\u4e0b\u3067\u5b9f\u884c\u3057\u305f\u4f8b\" width=\"538\" height=\"652\" class=\"alignnone size-full wp-image-3860\" \/><\/a><\/p>\n<h4>\uff12-\uff11-\uff11\uff0e\u5f15\u6570<span>pathname<\/span>\u306e\u307f\u3092\u6307\u5b9a<\/h4>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample01()\r\nDim str As String\r\n\r\nstr = Dir(\"C:\\SAMPLE\\SAMPLE.txt\")\r\nMsgBox str\r\n\r\nEnd Sub<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a\u7b2c\u4e00\u5f15\u6570\u3067\u6307\u5b9a\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3057\u3001\u5b58\u5728\u3057\u305f\u5834\u5408\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c1.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c1.png\" alt=\"\u5b9f\u884c\u7d50\u679c1\" width=\"160\" height=\"186\" class=\"alignnone size-full wp-image-3861\" \/><\/a><\/p>\n<h4>\uff12-\uff11-\uff12\uff0e\u5f15\u6570<span>pathname<\/span>\u304c\u7a7a\u3001<span>attributes<\/span>\u3092\u6307\u5b9a<\/h4>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample02()\r\n    Dim str As String\r\n\r\n    str = Dir(\"\", vbDirectory)\r\n\r\nMsgBox str\r\n\r\n\r\nEnd Sub<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a<span>C<\/span>\u30c9\u30e9\u30a4\u30d6\u76f4\u4e0b\u306b\u3042\u308b\u3001\u6700\u521d\u306b\u898b\u3064\u304b\u3063\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c2.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c2.png\" alt=\"\u5b9f\u884c\u7d50\u679c2\" width=\"160\" height=\"186\" class=\"alignnone size-full wp-image-3862\" \/><\/a><\/p>\n<h4>\uff12-\uff11-\uff13\uff0e\u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\u3092\u4f7f\u3063\u305f\u691c\u7d22<\/h4>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample03()\r\n    Dim str As String\r\n\r\n    str = Dir(\"C:\u00a5SAMPLE\\t*\")\r\n\r\nMsgBox str\r\n\r\n\r\nEnd Sub<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a\u6307\u5b9a\u3057\u305f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u30d1\u30b9\uff08<span>C:\u00a5SAMPLE<\/span>\uff09\u914d\u4e0b\u306b\u3042\u308b\u6700\u521d\u306b\u300c<span>t<\/span>\u300d\u304c\u4ed8\u304f\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c3.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c3.png\" alt=\"\u5b9f\u884c\u7d50\u679c3\" width=\"160\" height=\"186\" class=\"alignnone size-full wp-image-3863\" \/><\/a><\/p>\n<h3><span id=\"i-2\">\uff12-\uff12\uff0e\u305d\u306e\u4ed6\u306e\u4f7f\u7528\u4f8b<\/span><\/h3>\n<h4>\uff12-\uff12-\uff11\uff0e\u6307\u5b9a\u3057\u305f\u30d1\u30b9\u306b\u30d5\u30a1\u30a4\u30eb\u3084\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u8907\u6570\u5b58\u5728\u3057\u305f\u5834\u5408<\/h4>\n<p>\u5bfe\u8c61\u3068\u306a\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u8907\u6570\u5b58\u5728\u3057\u305f\u5834\u5408\u3001\u6700\u521d\u306e\u30d5\u30a1\u30a4\u30eb\u540d\u304c\u8fd4\u3055\u308c\u307e\u3059\u304c\u3001\u5168\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u53d6\u5f97\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample04()\r\n    Dim str As String\r\n    Dim val As String\r\n\r\n    str = Dir(\"C:\\SAMPLE\\*.txt\")\r\n    val = str\r\n\r\n    Do While str &lt;&gt; \"\"\r\n        str = Dir()\r\n    val = val &amp; vbCrLf &amp; str\r\n    Loop\r\n    \r\n    MsgBox val\r\n\r\nEnd Sub<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a<span>sample2.txt<\/span>\u306f\u96a0\u3057\u30d5\u30a1\u30a4\u30eb\u306e\u305f\u3081\u3001\u691c\u7d22\u7d50\u679c\u306b\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c4.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c4.png\" alt=\"\u5b9f\u884c\u7d50\u679c4\" width=\"160\" height=\"205\" class=\"alignnone size-full wp-image-3864\" \/><\/a><\/p>\n<h2><span id=\"VBA_Dir-2\">\uff13\uff0eVBA Dir\u95a2\u6570\u3092\u4f7f\u7528\u3059\u308b\u969b\u306e\u6ce8\u610f\u70b9<\/span><\/h2>\n<p><span>Dir<\/span>\u3092\u4f7f\u7528\u3059\u308b\u969b\u306b\u3001\u6ce8\u610f\u3059\u3079\u304d\u70b9\u304c\u3044\u304f\u3064\u304b\u3042\u308a\u307e\u3059\u3002<\/p>\n<h3><span id=\"-attributes256\"><span>\uff13-\uff11\uff0e<\/span>\u5f15\u6570\u306e<span>attributes<\/span>\u306b\u8a2d\u5b9a\u3059\u308b\u6587\u5b57\u5217\u304c<span>256<\/span>\u6587\u5b57\u8d85<\/span><\/h3>\n<p>\u5f15\u6570\u306e<span>attributes<\/span>\u306b\u8a2d\u5b9a\u3059\u308b\u6587\u5b57\u5217\u304c<span>256<\/span>\u6587\u5b57\u8d85\uff08<span>\u203b<\/span>\u30d0\u30a4\u30c8\u6570\u3067\u306f\u306a\u304f\u3001\u6587\u5b57\u6570\uff09\u3092\u8d85\u3048\u305f\u5834\u5408\u3001\u4e0b\u8a18\u30a8\u30e9\u30fc\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u6587\u5b57\u5217\u304c256\u6587\u5b57\u8d85\u3092\u8d85\u3048\u305f\u5834\u5408.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u6587\u5b57\u5217\u304c256\u6587\u5b57\u8d85\u3092\u8d85\u3048\u305f\u5834\u5408.png\" alt=\"\u6587\u5b57\u5217\u304c256\u6587\u5b57\u8d85\u3092\u8d85\u3048\u305f\u5834\u5408\" width=\"1200\" height=\"360\" class=\"alignnone size-full wp-image-3865\" srcset=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u6587\u5b57\u5217\u304c256\u6587\u5b57\u8d85\u3092\u8d85\u3048\u305f\u5834\u5408.png 1200w, https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u6587\u5b57\u5217\u304c256\u6587\u5b57\u8d85\u3092\u8d85\u3048\u305f\u5834\u5408-1024x307.png 1024w, https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u6587\u5b57\u5217\u304c256\u6587\u5b57\u8d85\u3092\u8d85\u3048\u305f\u5834\u5408-768x230.png 768w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u30a8\u30e9\u30fc\u753b\u9762.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u30a8\u30e9\u30fc\u753b\u9762.png\" alt=\"\u30a8\u30e9\u30fc\u753b\u9762\" width=\"488\" height=\"242\" class=\"alignnone size-full wp-image-3866\" \/><\/a><\/p>\n<h3><span id=\"i-3\">\uff13-\uff12\uff0e\u62e1\u5f35\u5b50\u304c\u4f3c\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u5834\u5408<\/span><\/h3>\n<p>\u8a2d\u5b9a\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u3001\u62e1\u5f35\u5b50\u304c\u300c<span>xls<\/span>\u300d\u300c<span>xlsm<\/span>\u300d\u300c<span>xlsx<\/span>\u300d\u306e\u3088\u3046\u306b\u4f3c\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u691c\u7d22\u5bfe\u8c61\u3092\u6307\u5b9a\u3057\u3066\u3082\u60f3\u5b9a\u3068\u306f\u7570\u306a\u308b\u7d50\u679c\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u62e1\u5f35\u5b50\u304c\u300cxls\u300d\u300cxlsm\u300d\u300cxlsx\u300d\u306e\u3088\u3046\u306b\u4f3c\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u5834.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u62e1\u5f35\u5b50\u304c\u300cxls\u300d\u300cxlsm\u300d\u300cxlsx\u300d\u306e\u3088\u3046\u306b\u4f3c\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u5834.png\" alt=\"\u62e1\u5f35\u5b50\u304c\u300cxls\u300d\u300cxlsm\u300d\u300cxlsx\u300d\u306e\u3088\u3046\u306b\u4f3c\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u5834\" width=\"483\" height=\"564\" class=\"alignnone size-full wp-image-3867\" \/><\/a><\/p>\n<pre class=\"prettyprint lang:default decode:true\">Sub sample05()\r\n    Dim str As String\r\n    Dim val As String\r\n\r\n    str = Dir(\"C:\\SAMPLE\\*.xls\")\r\n    val = str\r\n    Do While str &lt;&gt; \"\"\r\n        str = Dir()\r\n        val = val &amp; vbCrLf &amp; str\r\n    Loop\r\n\r\n    MsgBox val\r\n\r\nEnd Sub<\/pre>\n<p>\u5b9f\u884c\u7d50\u679c\uff1a<\/p>\n<p><a href=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c5.png\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.bold.ne.jp\/engineer-club\/wp-content\/uploads\/2022\/12\/\u5b9f\u884c\u7d50\u679c5.png\" alt=\"\u5b9f\u884c\u7d50\u679c5\" width=\"160\" height=\"224\" class=\"alignnone size-full wp-image-3868\" \/><\/a><\/p>\n<h2><span id=\"i-4\">\uff14\uff0e\u6700\u5f8c\u306b<\/span><\/h2>\n<p>Dir\u95a2\u6570\u306f\u3001\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u3084\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3057\u3066\u306e\u5b58\u5728\u78ba\u8a8d\u306b\u4f7f\u7528\u3059\u308b\u3053\u3068\u304c\u591a\u3044\u3067\u3059\u304c\u3001\u30d5\u30a1\u30a4\u30eb\u5c5e\u6027\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u3067\u3088\u308a\u7d30\u304b\u3044\u78ba\u8a8d\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u30d5\u30a1\u30a4\u30eb\u5c5e\u6027\u3092\u4f7f\u3046\u983b\u5ea6\u306f\u9ad8\u304f\u306a\u3044\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u304c\u3001\u982d\u306e\u7247\u9685\u306b\u5165\u308c\u3066\u304a\u304f\u3068\u3044\u3056\u3068\u3044\u3046\u6642\u306b\u5f79\u306b\u7acb\u3061\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Dir\u95a2\u6570\u306f\u3001\u300c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306b\u6307\u5b9a\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u304b\u300d\u3084\u300c\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306b\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u540d\u3084\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u53d6\u5f97\u3057\u305f\u3044\u300d\u6642\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002 \u76ee\u6b21\uff11\uff0eVBA\u306eDir\u95a2\u6570\u306b\u3064\u3044\u3066\uff11-\uff11\uff0eDir\u95a2\u6570\u3068\u306f\uff11-\uff12\uff0eDir\u95a2\u6570 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":3869,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/3858"}],"collection":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/comments?post=3858"}],"version-history":[{"count":8,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/3858\/revisions"}],"predecessor-version":[{"id":6112,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/posts\/3858\/revisions\/6112"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media\/3869"}],"wp:attachment":[{"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/media?parent=3858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bold.ne.jp\/engineer-club\/wp-json\/wp\/v2\/categories?post=3858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}