{"id":4827,"date":"2016-01-05T08:42:30","date_gmt":"2016-01-04T23:42:30","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=4827"},"modified":"2016-01-05T08:42:30","modified_gmt":"2016-01-04T23:42:30","slug":"inputfunction","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/inputfunction\/","title":{"rendered":"\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\uff1a\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u3080\uff08Input \u95a2\u6570\u30fbInputB \u95a2\u6570\uff09"},"content":{"rendered":"<h2>Input \u95a2\u6570\u30fbInputB \u95a2\u6570<\/h2>\n<div class=\"m30-l\">\n<p><a href=\"https:\/\/excelwork.info\/excel\/textopenclose\/\">Open \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/a>\u3092\u30b7\u30fc\u30b1\u30f3\u30b7\u30e3\u30eb\u5165\u529b\u30e2\u30fc\u30c9\uff08Input\uff09\u307e\u305f\u306f\u3001\u30d0\u30a4\u30ca\u30ea\u30e2\u30fc\u30c9\uff08Binary\uff09\u3067\u958b\u3044\u305f\u30d5\u30a1\u30a4\u30eb\u306e\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u8fbc\u307f\u307e\u3059\u3002\u30ab\u30f3\u30de\uff08,\uff09\u3001\u5f15\u7528\u7b26\u306a\u3069\u3001\u8aad\u307f\u53d6\u3063\u305f\u3059\u3079\u3066\u306e\u6587\u5b57\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>result<\/em> = <strong>Input<\/strong> ( <em>number<\/em>, <strong>#<\/strong>filenumber )<\/p>\n<p>    <em>result<\/em> = <strong>InputB<\/strong> ( <em>numberb<\/em>, <strong>#<\/strong>filenumber )<\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h3>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>number&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u53d6\u5f97\u3059\u308b\u6587\u5b57\u6570\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>numberb&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u53d6\u5f97\u3059\u308b\u30d0\u30a4\u30c8\u6570\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>filenumber&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<strong>Open \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong> \u3067\u3001\u5272\u308a\u5f53\u3066\u3089\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u756a\u53f7\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>result&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u958b\u3044\u305f\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u3001\u53d6\u5f97\u3057\u305f\u6587\u5b57\u5217\u578b\uff08String\uff09\u306e\u5024\u3002<\/li>\n<\/ul><\/div>\n<br \/>\n<p class=\"caution4\"><strong>Input \u95a2\u6570<\/strong>\u3067\u8aad\u307f\u53d6\u308b\u30c7\u30fc\u30bf\u306f\u3001\u901a\u5e38\u3001<strong>Print # \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong> \u307e\u305f\u306f <strong>Put \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8<\/strong>\u3067\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u307e\u308c\u307e\u3059\u3002<\/p>\n<\/div>\n<br \/><br \/>\n<h2>Input \u95a2\u6570\u30fbInputB \u95a2\u6570 \u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<p>Input \u95a2\u6570\u30fbInputB \u95a2\u6570 \u4f7f\u7528\u4f8b \u3067\u8aad\u307f\u8fbc\u3080\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9<\/p>\n<p><a href=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction00.jpg?ssl=1\" rel=\"lightbox[4827]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction00.jpg?resize=580%2C279&#038;ssl=1\" alt=\"Input \u95a2\u6570\u30fbInputB \u95a2\u6570 00\" width=\"580\" height=\"279\" class=\"alignnone size-large wp-image-4828\" srcset=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction00.jpg?resize=580%2C279&amp;ssl=1 580w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction00.jpg?resize=400%2C192&amp;ssl=1 400w, https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction00.jpg?w=636&amp;ssl=1 636w\" sizes=\"(max-width: 580px) 100vw, 580px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/>\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 1<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"Input \u95a2\u6570 \u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_InputFunction1()\r\n\r\n    'Input\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u8aad\u307f\u8fbc\u3080\r\n\r\n    Dim MyChar\r\n    Dim str\r\n    Dim FileName As String\r\n    Dim FNum As Integer\r\n    \r\n    FileName = \"C:\\Documents\\mydata\\file01.txt\"\r\n    FNum = FreeFile     '\u30d5\u30a1\u30a4\u30eb\u756a\u53f7\u53d6\u5f97\r\n    \r\n    'Input \u30e2\u30fc\u30c9\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\r\n    Open FileName For Input As #FNum\r\n    \r\n    '\u6587\u672b\u307e\u3067\u51e6\u7406\u3092\u7e70\u308a\u8fd4\u3059\uff08EOF \u95a2\u6570\u4f7f\u7528\uff09\r\n    Do Until EOF(FNum)\r\n        '1\u6587\u5b57\u3065\u3064\u53d6\u5f97\r\n        MyChar = Input(1, #FNum)\r\n        str = str & MyChar\r\n    Loop\r\n    \r\n    '\u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u308b\r\n    Close #FNum\r\n    \r\n    '\u5185\u5bb9\u3092\u8868\u793a\r\n    MsgBox str\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 1 \u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction01.jpg?ssl=1\" rel=\"lightbox[4827]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction01.jpg?resize=235%2C215&#038;ssl=1\" alt=\"Input \u95a2\u6570\u30fbInputB \u95a2\u6570 01\" width=\"235\" height=\"215\" class=\"alignnone size-full wp-image-4829\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/>\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 2<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"InputB \u95a2\u6570 \u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_InputFunction2()\r\n\r\n    'InputB\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u8aad\u307f\u8fbc\u3080\r\n\r\n    Dim str\r\n    Dim FileName As String\r\n    Dim FNum As Integer\r\n    Dim aaa\r\n    FileName = \"C:\\Documents\\mydata\\file01.txt\"\r\n    FNum = FreeFile     '\u30d5\u30a1\u30a4\u30eb\u756a\u53f7\u53d6\u5f97\r\n    \r\n    'Input \u30e2\u30fc\u30c9\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\r\n    Open FileName For Input As #FNum\r\n    \r\n    '\u30d5\u30a1\u30a4\u30eb\u5185\u5bb9\u3092\u4e00\u62ec\u3067\u53d6\u5f97\r\n    str = StrConv(InputB(FileLen(FileName), #FNum), vbUnicode)\r\n            \r\n    '\u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u308b\r\n    Close #FNum\r\n    \r\n    '\u5185\u5bb9\u3092\u8868\u793a\r\n    MsgBox str\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 2 \u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction02.jpg?ssl=1\" rel=\"lightbox[4827]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction02.jpg?resize=235%2C215&#038;ssl=1\" alt=\"Input \u95a2\u6570\u30fbInputB \u95a2\u6570 02\" width=\"235\" height=\"215\" class=\"alignnone size-full wp-image-4830\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/>\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 3<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"Input \u95a2\u6570 \u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_InputFunction3()\r\n\r\n    Dim FileName As String\r\n    Dim FNum As Integer\r\n    Dim MyLocation, MyLine\r\n\r\n\r\n    'Input\u95a2\u6570\u3092\u4f7f\u7528\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u8aad\u307f\u8fbc\u3080\r\n    \r\n    FileName = \"C:\\Documents\\mydata\\file01.txt\"\r\n    FNum = FreeFile     '\u30d5\u30a1\u30a4\u30eb\u756a\u53f7\u53d6\u5f97\r\n\r\n    'Binary \u30e2\u30fc\u30c9\u3067\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\r\n    Open FileName For Binary As #FNum\r\n    \r\n    '\u6587\u672b\u307e\u3067\u51e6\u7406\u3092\u7e70\u308a\u8fd4\u3059\uff08LOF \u95a2\u6570\u3001Loc \u95a2\u6570\u4f7f\u7528\uff09\r\n    Do While MyLocation < LOF(FNum)\r\n        '1\u6587\u5b57\u3065\u3064\u53d6\u5f97\r\n        MyLine = MyLine &#038; Input(1, #FNum)\r\n        '\u73fe\u5728\u306e\u8aad\u307f\u53d6\u308a\u4f4d\u7f6e\u3092\u53d6\u5f97\r\n        MyLocation = Loc(FNum)\r\n    Loop\r\n    \r\n    '\u5185\u5bb9\u3092\u8868\u793a\r\n    MsgBox MyLine &#038; vbCrLf &#038; \"\u30d5\u30a1\u30a4\u30eb\u30b5\u30a4\u30ba\uff1a\" &#038; MyLocation\r\n    \r\n    '\u30d5\u30a1\u30a4\u30eb\u3092\u9589\u3058\u308b\r\n    Close #1\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9 3 \u5b9f\u884c\u7d50\u679c<\/h3>\n<p><a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction03.jpg?ssl=1\" rel=\"lightbox[4827]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction03.jpg?resize=235%2C245&#038;ssl=1\" alt=\"Input \u95a2\u6570\u30fbInputB \u95a2\u6570 03\" width=\"235\" height=\"245\" class=\"alignnone size-full wp-image-4831\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>Input \u95a2\u6570\u30fbInputB \u95a2\u6570 Open \u30b9\u30c6\u30fc\u30c8\u30e1\u30f3\u30c8\u3092\u30b7\u30fc\u30b1\u30f3\u30b7\u30e3\u30eb\u5165 &#8230; <\/p>\n","protected":false},"author":1,"featured_media":4837,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[675],"tags":[693,747,731,63,38,729],"jetpack_featured_media_url":"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/01\/inputfunction00-580x279-1.jpg?fit=580%2C279&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1fR","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/4827"}],"collection":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/comments?post=4827"}],"version-history":[{"count":5,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/4827\/revisions"}],"predecessor-version":[{"id":4836,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/4827\/revisions\/4836"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/4837"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=4827"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=4827"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=4827"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}