{"id":5275,"date":"2016-03-28T20:17:11","date_gmt":"2016-03-28T11:17:11","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=5275"},"modified":"2016-03-28T20:17:11","modified_gmt":"2016-03-28T11:17:11","slug":"fsocopyfilemethod","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/fsocopyfilemethod\/","title":{"rendered":"FileSystemObject\uff1a\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\uff08CopyFile \u30e1\u30bd\u30c3\u30c9\uff09"},"content":{"rendered":"<h2>\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308b\uff08CopyFile \u30e1\u30bd\u30c3\u30c9\uff09<\/h2>\n<div class=\"m30-l\">\n<p><strong>FileSystemObject\uff08FSO\uff09<\/strong>\u3092\u4f7f\u7528\u3057\u3066\u3001\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<strong>FileSystemObject\uff08FSO\uff09<\/strong>\u306e\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u3092\u751f\u6210\u3059\u308b\u65b9\u6cd5\u306f\u3001<a href=\"https:\/\/excelwork.info\/excel\/filesystemobject\/\">\u30d5\u30a1\u30a4\u30eb\u30b7\u30b9\u30c6\u30e0\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\uff08FileSystemObject\uff09\u306e\u4f7f\u3044\u65b9<\/a> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>CopyFile<\/strong> ( <em>source<\/em>, <em>destination<\/em> [, <em>overwritefiles<\/em> ] )<\/p><\/div>\n<br \/>\n<h4>\u5f15\u6570\u30fb\u623b\u308a\u5024<\/h4>\n<div class=\"m30-l\">\n<ul style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;\">\n<li>object&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;<span class=\"red\"><strong>FileSystemObject \u30aa\u30d6\u30b8\u30a7\u30af\u30c8<\/strong><\/span>\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>source&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30b3\u30d4\u30fc\u5143\u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u542b\u3080\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u30d1\u30b9\u3092\u7701\u7565\u3059\u308b\u3068\u30ab\u30ec\u30f3\u30c8\u30d5\u30a9\u30eb\u30c0\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u5bfe\u8c61\u3068\u306a\u308a\u307e\u3059\u3002<\/li>\n<li>destination&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30b3\u30d4\u30fc\u5148\u306e\u30d1\u30b9\u3068\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u3053\u3053\u306b\u30d1\u30b9\u306e\u307f\uff08\u300c\\\u300d\u3067\u7d42\u308f\u308b\uff09\u6307\u5b9a\u3057\u305f\u5834\u5408\u3001<em>source<\/em> \u3067\u6307\u5b9a\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u540d\u3068\u306a\u308a\u307e\u3059\u3002\u30d5\u30a1\u30a4\u30eb\u540d\u306e\u307f\u6307\u5b9a\u3057\u305f\u5834\u5408\u3001\u30ab\u30ec\u30f3\u30c8\u30d5\u30a9\u30eb\u30c0\u306b\u30d5\u30a1\u30a4\u30eb\u304c\u30b3\u30d4\u30fc\u3055\u308c\u307e\u3059\u3002<\/li>\n<li>overwritefiles&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u30b3\u30d4\u30fc\u5148\u306b\u540c\u540d\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u5834\u5408\u306b\u4e0a\u66f8\u304d\u3059\u308b\u5834\u5408\u306f\u3001<strong>True<\/strong>\u3001\u3057\u306a\u3044\u5834\u5408\u306f\u3001<strong>False<\/strong> \u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u7701\u7565\u3059\u308b\u3068 <strong>True<\/strong> \u3092\u6307\u5b9a\u3057\u305f\u3082\u306e\u3068\u3055\u308c\u307e\u3059\u3002<\/li>\n<\/ul>\n<br \/>\n<p class=\"caution8\">\u5f15\u6570 <em>source<\/em> \u306e\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u306f\u3001\u30ef\u30a4\u30eb\u30c9\u30ab\u30fc\u30c9\u304c\u4f7f\u7528\u3067\u304d\u3001\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u8907\u6570\u3042\u308c\u3070\u307e\u3068\u3081\u3066\u30b3\u30d4\u30fc\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u304c\u306a\u3044\u5834\u5408\u3001\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n<p class=\"caution8\">\u5f15\u6570 <em>overwritefiles<\/em> \u306b <strong>False<\/strong> \u3092\u6307\u5b9a\u3057\u305f\u5834\u5408\u3001\u30b3\u30d4\u30fc\u5148\u306b\u540c\u540d\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u3068\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n<\/p><\/div>\n<\/div>\n<br \/><br \/>\n<h2>ConvertFormula \u30e1\u30bd\u30c3\u30c9 \u4f7f\u7528\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"ConvertFormula \u30e1\u30bd\u30c3\u30c9 \u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_FSO_copyfile()\r\n\r\n    '\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308b\r\n    Dim fso As New FileSystemObject\r\n    Dim file1 As String, file2 As String\r\n    \r\nOn Error GoTo myErr\r\n    \r\n    file1 = \"C:\\Documents\\data2\\*\"\r\n    file2 = \"C:\\Documents\\data2\\aaa\\\"\r\n    \r\n    '\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\r\n    fso.CopyFile Source:=file1, Destination:=file2, overwritefiles:=False\r\n    \r\n    Exit Sub\r\n    \r\nmyErr:\r\n    '\u30a8\u30e9\u30fc\u306e\u5185\u5bb9\u3092\u8868\u793a\r\n    MsgBox Err.Description\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c<\/h3>\n<p> C:\\Documents\\data2 \u30d5\u30a9\u30eb\u30c0\u306b\u306f\u3001\u300ctest1.txt\u300d\u3001\u300ctest2.txt\u300d\u3001C:\\Documents\\data2\\aaa \u30d5\u30a9\u30eb\u30c0\u306b\u3082\u3001\u300ctest1.txt\u300d\u3001\u300ctest2.txt\u300d\u304c\u5b58\u5728\u3057\u3066\u3044\u308b\u72b6\u614b\u3067\u3001\u300c\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b9\u300d\u5b9f\u884c<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/03\/FSO_copyfile.jpg?ssl=1\" rel=\"lightbox[5275]\"><img loading=\"lazy\" src=\"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/03\/FSO_copyfile.jpg?resize=244%2C155&#038;ssl=1\" alt=\"FSO CopyFile \u30e1\u30bd\u30c3\u30c9\" width=\"244\" height=\"155\" class=\"alignnone size-full wp-image-5276\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308b\uff08CopyFile \u30e1\u30bd\u30c3\u30c9\uff09 FileSystemObje &#8230; <\/p>\n","protected":false},"author":1,"featured_media":5276,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[836],"tags":[838,721,693,722,834,63,38],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/03\/FSO_copyfile.jpg?fit=244%2C155&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1n5","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5275"}],"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=5275"}],"version-history":[{"count":5,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5275\/revisions"}],"predecessor-version":[{"id":5312,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5275\/revisions\/5312"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/5276"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=5275"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=5275"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=5275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}