{"id":3607,"date":"2023-09-30T00:09:48","date_gmt":"2023-09-30T00:09:48","guid":{"rendered":"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/"},"modified":"2023-12-07T04:56:20","modified_gmt":"2023-12-07T04:56:20","slug":"%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab","status":"publish","type":"page","link":"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/","title":{"rendered":"Vba \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u66f8\u304d\u8fbc\u3080\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3059\u304b?"},"content":{"rendered":"<div class=\"excel-\" id=\"excel-2175513626\"><script type=\"text\/javascript\">\r\n\tatOptions = {\r\n\t\t'key' : 'c1158f160081d6540a8409e6925dab94',\r\n\t\t'format' : 'iframe',\r\n\t\t'height' : 250,\r\n\t\t'width' : 300,\r\n\t\t'params' : {}\r\n\t};\r\n<\/script>\r\n<script type=\"text\/javascript\" src=\"\/\/www.highperformanceformat.com\/c1158f160081d6540a8409e6925dab94\/invoke.js\"><\/script><\/div> <p>VBA \u30b3\u30fc\u30c9\u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8\u3092\u4f5c\u6210\u3059\u308b\u306b\u306f\u3001CreateTextFile \u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u65b9\u6cd5\u3067\u306f\u3001\u4f5c\u6210\u3059\u308b\u5834\u6240\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306e\u69cb\u6587\u3067\u306f\u3001\u305d\u306e\u5834\u6240\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u66f8\u304d\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u6307\u5b9a\u3057\u3001\u30d5\u30a1\u30a4\u30eb\u3092 Unicode \u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4f5c\u6210\u3059\u308b\u304b ASCII \u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4f5c\u6210\u3059\u308b\u304b\u3092\u6307\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p><h2 class=\"wp-block-heading\"> VBA\u3067\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b<\/h2><p>\u6b21\u306e\u624b\u9806\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p><ol><li>\u307e\u305a\u3001\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u3067\u4f7f\u7528\u3059\u308b FileSystemObject \u307e\u305f\u306f Folder \u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"1-vba\u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-creer-un-fichier-texte-en-utilisant-vba.png\" sizes=\"auto, \" srcset=\"\" alt=\"create-a-text-fie-using-vba\" width=\"522\" height=\"305\"><\/li><li>\u305d\u306e\u5f8c\u3001CreateTextFile \u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u5225\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"2-\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210\u65b9\u6cd5\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/2-Creer-une-methode-de-fichier-texte.png\" sizes=\"auto, \" srcset=\"\" alt=\"create-text-file-method\" width=\"779\" height=\"321\"><\/li><li>\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u30d5\u30a9\u30eb\u30c0\u30fc\u5185\u306b\u540c\u3058\u540d\u524d\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u3059\u3067\u306b\u5b58\u5728\u3059\u308b\u5834\u5408\u306b\u4e0a\u66f8\u304d\u3059\u308b\u305f\u3081\u306b TRUE \u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/li><li>\u6700\u5f8c\u306b\u3001\u3053\u306e\u30de\u30af\u30ed\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u6b21\u306e\u3088\u3046\u306b\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u65b0\u3057\u3044\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/li><\/ol><pre class=\"wp-block-code\"> <code class=\"language-visual-basic\" lang=\"visual-basic\">Sub create_text_file() 'object to use as folder Dim fld As Object Set fld = CreateObject(\"Scripting.FileSystemObject\") 'using create text file method Dim myFile As Object Set myFile = fld.CreateTextFile(\"C:UsersDellDesktopmyFoldermyTextFile.txt\", True) End Sub<\/code><\/pre><h2 class=\"wp-block-heading\"> CreateTextFile \u30e1\u30bd\u30c3\u30c9\u306e\u69cb\u6587<\/h2><pre class=\"wp-block-code\"> <code class=\"language-visual-basic\" lang=\"visual-basic\">CreateTextFile (filename, [ overwrite, [ unicode ]])<\/code><\/pre><ul><li><strong>filename:<\/strong>\u4f5c\u6210\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3068\u540d\u524d\u3002<\/li><li> <strong>overwrite:<\/strong>\u30d5\u30a1\u30a4\u30eb\u3092\u4e0a\u66f8\u304d\u3059\u308b\u304b\u3069\u3046\u304b\u3092\u5b9a\u7fa9\u3059\u308b\u30d6\u30fc\u30eb\u5024 (\u65e2\u306b\u5b58\u5728\u3059\u308b\u5834\u5408) (\u30aa\u30d7\u30b7\u30e7\u30f3)\u3002<\/li><li> <strong>unicode:<\/strong>\u30d5\u30a1\u30a4\u30eb\u3092 Unicode \u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4f5c\u6210\u3059\u308b\u304b ASCII \u30d5\u30a1\u30a4\u30eb\u3068\u3057\u3066\u4f5c\u6210\u3059\u308b\u304b\u3092\u5b9a\u7fa9\u3059\u308b\u30d6\u30fc\u30eb\u5024 (\u30aa\u30d7\u30b7\u30e7\u30f3)\u3002<\/li><\/ul><h2 class=\"wp-block-heading\"> VBA \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080<\/h2><p>2 \u3064\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3057\u3066\u3001\u30c7\u30fc\u30bf\u3092\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p><ol><li><strong data-rich-text-format-boundary=\"true\">\u66f8\u304d\u8fbc\u307f:<\/strong>\u3053\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u5024\u306e\u9593\u306b\u30ab\u30f3\u30de\u3001\u6587\u5b57\u5217\u3092\u5f15\u7528\u7b26\u3067\u56f2\u307f\u3001\u65e5\u4ed8\u3092 # \u8a18\u53f7\u3067\u56f2\u3093\u3060\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u3092\u66f8\u304d\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"3\u66f8\u304d\u8fbc\u307f\u547d\u4ee4\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/3-ecrire-une-declaration.png\" sizes=\"auto, \" srcset=\"\" alt=\"write-statement\" width=\"496\" height=\"291\"><\/li><li><strong data-rich-text-format-boundary=\"true\">\u5370\u5237:<\/strong>\u3053\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001Excel \u30b9\u30d7\u30ec\u30c3\u30c9\u30b7\u30fc\u30c8\u3068\u307e\u3063\u305f\u304f\u540c\u3058\u5916\u89b3\u3067\u30c7\u30fc\u30bf\u3092\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"4 \u6587\u5b57\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/4-declaration-dimpression.png\" sizes=\"auto, \" srcset=\"\" alt=\"print-statement\" width=\"650\" height=\"344\"><\/li><\/ol><p>\u3053\u3053\u3067\u3001\u4e21\u65b9\u306e\u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u306e\u4f8b\u3092\u898b\u3066\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u305f\u3081\u306e\u5b8c\u5168\u306a\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3059\u308b\u65b9\u6cd5\u3092\u7406\u89e3\u3057\u307e\u3059\u3002\u305f\u3060\u3057\u3001\u305d\u306e\u524d\u306b\u3001\u5e0c\u671b\u3069\u304a\u308a\u306b\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3059\u308b\u305f\u3081\u306b<strong>\u3044\u304f\u3064\u304b\u306e\u7528\u8a9e\u3092<\/strong>\u7406\u89e3\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p><ul><li><strong>\u51fa\u529b\u306e\u5834\u5408:<\/strong>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306f\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u3092\u66f8\u304d\u8fbc\u3093\u3060\u308a\u3001\u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3057\u305f\u308a\u3059\u308b\u3068\u304d\u306b\u4f7f\u7528\u3067\u304d\u307e\u3059\u3002<\/li><li><strong>\u5165\u529b\u306e\u5834\u5408:<\/strong>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3059\u308b\u3068\u3001\u30c6\u30ad\u30b9\u30c8\u304b\u3089\u30c7\u30fc\u30bf\u3092\u62bd\u51fa\u3067\u304d\u307e\u3059\u304c\u3001\u30c7\u30fc\u30bf\u3092\u5909\u66f4\u3057\u305f\u308a\u3001\u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002<\/li><li><strong>\u8ffd\u52a0\u3059\u308b\u306b\u306f:<\/strong>\u3053\u306e\u30b3\u30de\u30f3\u30c9\u306f\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306e\u6700\u5f8c\u306b\u65b0\u3057\u3044\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3059\u308b\u306e\u306b\u5f79\u7acb\u3061\u307e\u3059\u3002<\/li><li> <strong>FreeFile\uff1a<\/strong>\u4f7f\u7528\u3057\u305f\u3044\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u4f7f\u7528\u3055\u308c\u3066\u3044\u306a\u3044\u30d5\u30a1\u30a4\u30eb\u756a\u53f7\u3092\u8a2d\u5b9a\u3057\u3001\u53c2\u7167\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/li><\/ul><p>\u6b21\u306b\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u3092\u5165\u529b\u3059\u308b\u30b3\u30fc\u30c9\u3092\u8a18\u8ff0\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002<\/p><ol><li>\u307e\u305a\u3001\u30b3\u30fc\u30c9\u5185\u3067\u4f7f\u7528\u3059\u308b\u5909\u6570\u3092\u5ba3\u8a00\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"5 \u3064\u306e\u5ba3\u8a00\u5909\u6570\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/5-declarer-des-variables.png\" sizes=\"auto, \" srcset=\"\" alt=\"declare-variables\" width=\"381\" height=\"337\"><\/li><li>\u305d\u306e\u5f8c\u3001\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u5fc5\u8981\u304c\u3042\u308b\u7bc4\u56f2\u3092\u5b9a\u7fa9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u3057\u3066\u3001\u7bc4\u56f2\u5185\u306e\u30bb\u30eb\u306e\u6570\u3092\u5909\u6570\u306b\u8a2d\u5b9a\u3057\u3066\u3001\u30eb\u30fc\u30d7\u306e\u30ab\u30a6\u30f3\u30bf\u30fc\u3068\u3057\u3066\u4f7f\u7528\u3057\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"6-\u7bc4\u56f2\u306e\u5b9a\u7fa9\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/6-definir-la-gamme.png\" sizes=\"auto, \" srcset=\"\" alt=\"define-the-range\" width=\"416\" height=\"114\"><\/li><li>\u6b21\u306b\u3001\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3059\u308b\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c9\u30ec\u30b9\u3092\u8a2d\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"7-\u8a2d\u5b9a\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u306e\u30a2\u30c9\u30ec\u30b9\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/7-definir-ladresse-du-fichier-texte.png\" sizes=\"auto, \" srcset=\"\" alt=\"define-the-address-of-the-text-file\" width=\"575\" height=\"99\"><\/li><li>\u305d\u3053\u304b\u3089\u3001\u300cFreeFile\u300d\u30b3\u30de\u30f3\u30c9\u3092\u5909\u6570\u306b\u5ba3\u8a00\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u756a\u53f7\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"8-freefile-\u30b3\u30de\u30f3\u30c9\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/8-commande-de-fichier-libre.png\" sizes=\"auto, \" srcset=\"\" alt=\"freefile-command\" width=\"452\" height=\"80\"><\/li><li>\u30d5\u30a1\u30a4\u30eb\u306b\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305f\u3081\u3001\u300c\u51fa\u529b\u300d\u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"9\u51fa\u529b\u5236\u5fa1\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/9-sortie-de-commande.png\" sizes=\"auto, \" srcset=\"\" alt=\"output-command\" width=\"580\" height=\"80\"><\/li><li>\u6700\u5f8c\u306b\u3001\u300cFor Next\u300d\u30eb\u30fc\u30d7\u3092\u4f7f\u7528\u3057\u3066\u7bc4\u56f2\u5024\u3092 1 \u3064\u305a\u3064\u53d6\u5f97\u3057\u3001\u30d5\u30a1\u30a4\u30eb\u306b\u8ffd\u52a0\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"\u5024\u3092\u53d6\u5f97\u3059\u308b\u305f\u3081\u306e 10 for next \u30eb\u30fc\u30d7\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/10-pour-la-prochaine-boucle-pour-obtenir-des-valeurs.png\" sizes=\"auto, \" srcset=\"\" alt=\"for-next-loop-to-get-values\" width=\"436\" height=\"201\"><\/li><li>\u3055\u3089\u306b\u3001\u30c7\u30fc\u30bf\u3092\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u8ffd\u52a0\u3057\u305f\u5f8c\u3001close \u30b3\u30de\u30f3\u30c9\u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"11-\u7d42\u4e86\u30b3\u30de\u30f3\u30c9\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/11-commande-de-fermeture.png\" sizes=\"auto, \" srcset=\"\" alt=\"close-command\" width=\"549\" height=\"86\"><\/li><li>\u6700\u7d42\u7684\u306b\u3001\u3053\u306e\u30de\u30af\u30ed\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u7bc4\u56f2 A1:A13 \u306e\u30c7\u30fc\u30bf\u304c\u3001\u6307\u5b9a\u3057\u305f\u30d1\u30b9\u306b\u4fdd\u5b58\u3057\u305f\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u8ffd\u52a0\u3055\u308c\u307e\u3059\u3002 <br><img loading=\"lazy\" decoding=\"async\" title=\"12-\u30de\u30af\u30ed\u306e\u5b9f\u884c\" src=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/12-executer-la-macro.png\" sizes=\"auto, \" srcset=\"\" alt=\"run-the-macro\" width=\"464\" height=\"404\"><\/li><\/ol><p class=\"qt-tip\"><strong>\u6ce8:<\/strong>\u30b7\u30b9\u30c6\u30e0\u5185\u306e\u30d1\u30b9\u306b\u5f93\u3063\u3066\u3001\u30b3\u30fc\u30c9\u304b\u3089\u306e\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u5fc5\u305a\u5909\u66f4\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p><pre class=\"wp-block-code\"> <code class=\"language-visual-basic\" lang=\"visual-basic\">Option Explicit Sub data_to_text_file() 'variables that you need to use in the code Dim TextFile As Integer Dim iCol As Integer Dim myRange As Range Dim cVal As Range Dim i As Integer Dim myFile As String 'define the range that you want to write Set myRange = Range(\"A1:A13\") iCol = myRange.Count 'path to the text file <strong>(MAKE SURE TO CHANGE IT)<\/strong> myFile = \"C:UsersDellDesktopNewFoldertextfile.txt\" 'define FreeFile to the variable file number TextFile = FreeFile 'using append command to add text to the end of the file Open myFile For Output As TextFile 'loop to add data to the text file For i = 1 To iCol Print #TextFile, Cells(i, 1), Print #TextFile, Cells(i, 2) Next i 'close command to close the text file after adding data Close #TextFile End Sub<\/code><\/pre><div class=\"gb-container gb-container-4db6181c gb-container-mt\"> <a class=\"gb-button gb-button-c5897111 gb-button-text gb-button-mt-button\" href=\"https:\/\/exceladvisor.org\/ja\/vba\/\">VBA\u3068\u306f<\/a><h2 class=\"gb-headline gb-headline-665e5f6b gb-headline-text gb-headline-mt-heading\">\u95a2\u9023\u3059\u308b\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb<\/h2><div class=\"gb-grid-wrapper gb-grid-wrapper-a20baf7c gb-grid-wrapper-mt-grid\"><div class=\"gb-grid-column gb-grid-column-65ddf67e\"><div class=\"gb-container gb-container-65ddf67e\"><ul><li> <a href=\"https:\/\/exceladvisor.org\/ja\/\u91cd\u8907\u3057\u305f\u5024\u3092\u5f37\u8abf\u8868\u793a\u3059\u308b\/\">VBA\u3092\u4f7f\u7528\u3057\u3066\u91cd\u8907\u3057\u305f\u5024\u3092\u5f37\u8abf\u8868\u793a\u3059\u308b<\/a><\/li><li>\u30cf\u30a4\u30d1\u30fc\u30ea\u30f3\u30af \u30a2\u30c9\u30ec\u30b9 (URL) \u3092\u62bd\u51fa\u3059\u308b VBA<\/li><li> VBA\u306e\u5165\u529b\u30dc\u30c3\u30af\u30b9<\/li><li><a href=\"https:\/\/exceladvisor.org\/ja\/\u753b\u9762\u66f4\u65b0\/\">VBA\u753b\u9762\u66f4\u65b0<\/a><\/li><li>VBA \u30b9\u30c6\u30fc\u30bf\u30b9 \u30d0\u30fc (\u975e\u8868\u793a\u3001\u8868\u793a\u3001\u9032\u884c\u72b6\u6cc1) <\/li><\/ul><\/div><\/div><div class=\"gb-grid-column gb-grid-column-50067b57\"><div class=\"gb-container gb-container-50067b57\"><\/div><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"ub_ctt_via":"","footnotes":""},"class_list":["post-3607","page","type-page","status-publish","hentry"],"featured_image_src":null,"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u25b7 VBA \u7d4c\u7531\u3067\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u66f8\u304d\u8fbc\u3080\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3059\u304b?<\/title>\n<meta name=\"description\" content=\"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u30012 \u3064\u306e\u7570\u306a\u308b\u65b9\u6cd5 (\u5370\u5237\u3068\u66f8\u304d\u8fbc\u307f) \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3059\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/exceladvisor.org\/ja\/\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\/\" \/>\n<meta property=\"og:locale\" content=\"ja_JP\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u25b7 VBA \u7d4c\u7531\u3067\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u66f8\u304d\u8fbc\u3080\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3059\u304b?\" \/>\n<meta property=\"og:description\" content=\"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u30012 \u3064\u306e\u7570\u306a\u308b\u65b9\u6cd5 (\u5370\u5237\u3068\u66f8\u304d\u8fbc\u307f) \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3059\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/exceladvisor.org\/ja\/\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\/\" \/>\n<meta property=\"og:site_name\" content=\"Excel Advisor\" \/>\n<meta property=\"article:modified_time\" content=\"2023-12-07T04:56:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-creer-un-fichier-texte-en-utilisant-vba.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593\" \/>\n\t<meta name=\"twitter:data1\" content=\"1\u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/\",\"url\":\"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/\",\"name\":\"\u25b7 VBA \u7d4c\u7531\u3067\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u66f8\u304d\u8fbc\u3080\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3059\u304b?\",\"isPartOf\":{\"@id\":\"https:\/\/exceladvisor.org\/ja\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-creer-un-fichier-texte-en-utilisant-vba.png\",\"datePublished\":\"2023-09-30T00:09:48+00:00\",\"dateModified\":\"2023-12-07T04:56:20+00:00\",\"description\":\"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u30012 \u3064\u306e\u7570\u306a\u308b\u65b9\u6cd5 (\u5370\u5237\u3068\u66f8\u304d\u8fbc\u307f) \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3059\u3002\",\"breadcrumb\":{\"@id\":\"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#breadcrumb\"},\"inLanguage\":\"ja\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#primaryimage\",\"url\":\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-creer-un-fichier-texte-en-utilisant-vba.png\",\"contentUrl\":\"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-creer-un-fichier-texte-en-utilisant-vba.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u5bb6\",\"item\":\"https:\/\/exceladvisor.org\/ja\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Vba \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u66f8\u304d\u8fbc\u3080\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3059\u304b?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/exceladvisor.org\/ja\/#website\",\"url\":\"https:\/\/exceladvisor.org\/ja\/\",\"name\":\"Excel Advisor\",\"description\":\"\u30c7\u30fc\u30bf\u3092\u652f\u914d\u3059\u308b\u305f\u3081\u306e\u7a76\u6975\u306e\u30ac\u30a4\u30c9!\",\"publisher\":{\"@id\":\"https:\/\/exceladvisor.org\/ja\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/exceladvisor.org\/ja\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ja\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/exceladvisor.org\/ja\/#organization\",\"name\":\"Excel Advisor\",\"url\":\"https:\/\/exceladvisor.org\/ja\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ja\",\"@id\":\"https:\/\/exceladvisor.org\/ja\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/exceladvisor.org\/ja\/wp-content\/uploads\/2023\/12\/exceladvisor.org_.png\",\"contentUrl\":\"https:\/\/exceladvisor.org\/ja\/wp-content\/uploads\/2023\/12\/exceladvisor.org_.png\",\"width\":105,\"height\":36,\"caption\":\"Excel Advisor\"},\"image\":{\"@id\":\"https:\/\/exceladvisor.org\/ja\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u25b7 VBA \u7d4c\u7531\u3067\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u66f8\u304d\u8fbc\u3080\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3059\u304b?","description":"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u30012 \u3064\u306e\u7570\u306a\u308b\u65b9\u6cd5 (\u5370\u5237\u3068\u66f8\u304d\u8fbc\u307f) \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3059\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/exceladvisor.org\/ja\/\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\/","og_locale":"ja_JP","og_type":"article","og_title":"\u25b7 VBA \u7d4c\u7531\u3067\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u66f8\u304d\u8fbc\u3080\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3059\u304b?","og_description":"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u30012 \u3064\u306e\u7570\u306a\u308b\u65b9\u6cd5 (\u5370\u5237\u3068\u66f8\u304d\u8fbc\u307f) \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3059\u3002","og_url":"https:\/\/exceladvisor.org\/ja\/\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\/","og_site_name":"Excel Advisor","article_modified_time":"2023-12-07T04:56:20+00:00","og_image":[{"url":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-creer-un-fichier-texte-en-utilisant-vba.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"\u63a8\u5b9a\u8aad\u307f\u53d6\u308a\u6642\u9593":"1\u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/","url":"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/","name":"\u25b7 VBA \u7d4c\u7531\u3067\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u66f8\u304d\u8fbc\u3080\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3059\u304b?","isPartOf":{"@id":"https:\/\/exceladvisor.org\/ja\/#website"},"primaryImageOfPage":{"@id":"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#primaryimage"},"image":{"@id":"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#primaryimage"},"thumbnailUrl":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-creer-un-fichier-texte-en-utilisant-vba.png","datePublished":"2023-09-30T00:09:48+00:00","dateModified":"2023-12-07T04:56:20+00:00","description":"\u3053\u306e\u30c1\u30e5\u30fc\u30c8\u30ea\u30a2\u30eb\u3067\u306f\u3001\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u30012 \u3064\u306e\u7570\u306a\u308b\u65b9\u6cd5 (\u5370\u5237\u3068\u66f8\u304d\u8fbc\u307f) \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\u65b9\u6cd5\u3092\u5b66\u3073\u307e\u3059\u3002","breadcrumb":{"@id":"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#breadcrumb"},"inLanguage":"ja","potentialAction":[{"@type":"ReadAction","target":["https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/"]}]},{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#primaryimage","url":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-creer-un-fichier-texte-en-utilisant-vba.png","contentUrl":"https:\/\/exceladvisor.org\/wp-content\/uploads\/2023\/08\/1-creer-un-fichier-texte-en-utilisant-vba.png"},{"@type":"BreadcrumbList","@id":"https:\/\/exceladvisor.org\/ja\/%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u5bb6","item":"https:\/\/exceladvisor.org\/ja\/"},{"@type":"ListItem","position":2,"name":"Vba \u3092\u4f7f\u7528\u3057\u3066\u30c6\u30ad\u30b9\u30c8 \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3057\u3066\u66f8\u304d\u8fbc\u3080\u306b\u306f\u3069\u3046\u3059\u308c\u3070\u3088\u3044\u3067\u3059\u304b?"}]},{"@type":"WebSite","@id":"https:\/\/exceladvisor.org\/ja\/#website","url":"https:\/\/exceladvisor.org\/ja\/","name":"Excel Advisor","description":"\u30c7\u30fc\u30bf\u3092\u652f\u914d\u3059\u308b\u305f\u3081\u306e\u7a76\u6975\u306e\u30ac\u30a4\u30c9!","publisher":{"@id":"https:\/\/exceladvisor.org\/ja\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/exceladvisor.org\/ja\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ja"},{"@type":"Organization","@id":"https:\/\/exceladvisor.org\/ja\/#organization","name":"Excel Advisor","url":"https:\/\/exceladvisor.org\/ja\/","logo":{"@type":"ImageObject","inLanguage":"ja","@id":"https:\/\/exceladvisor.org\/ja\/#\/schema\/logo\/image\/","url":"https:\/\/exceladvisor.org\/ja\/wp-content\/uploads\/2023\/12\/exceladvisor.org_.png","contentUrl":"https:\/\/exceladvisor.org\/ja\/wp-content\/uploads\/2023\/12\/exceladvisor.org_.png","width":105,"height":36,"caption":"Excel Advisor"},"image":{"@id":"https:\/\/exceladvisor.org\/ja\/#\/schema\/logo\/image\/"}}]}},"yoast_meta":{"yoast_wpseo_title":"","yoast_wpseo_metadesc":"","yoast_wpseo_canonical":""},"_links":{"self":[{"href":"https:\/\/exceladvisor.org\/ja\/wp-json\/wp\/v2\/pages\/3607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/exceladvisor.org\/ja\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/exceladvisor.org\/ja\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/exceladvisor.org\/ja\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/exceladvisor.org\/ja\/wp-json\/wp\/v2\/comments?post=3607"}],"version-history":[{"count":1,"href":"https:\/\/exceladvisor.org\/ja\/wp-json\/wp\/v2\/pages\/3607\/revisions"}],"predecessor-version":[{"id":4164,"href":"https:\/\/exceladvisor.org\/ja\/wp-json\/wp\/v2\/pages\/3607\/revisions\/4164"}],"wp:attachment":[{"href":"https:\/\/exceladvisor.org\/ja\/wp-json\/wp\/v2\/media?parent=3607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}