{"id":5327,"date":"2016-04-13T20:03:28","date_gmt":"2016-04-13T11:03:28","guid":{"rendered":"http:\/\/excelwork.info\/excel\/?p=5327"},"modified":"2016-04-13T20:03:28","modified_gmt":"2016-04-13T11:03:28","slug":"fsogetfoldernamefilename","status":"publish","type":"post","link":"https:\/\/excelwork.info\/excel\/fsogetfoldernamefilename\/","title":{"rendered":"FileSystemObject\uff1a\u30d5\u30eb\u30d1\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u540d\u3001\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308b\uff08GetFileName\u3001GetParentFolderName\uff09"},"content":{"rendered":"<h2>\u30d5\u30eb\u30d1\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u540d\u3084\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308b<\/h2>\n<div class=\"m30-l\">\n<p><strong>FileSystemObject\uff08FSO\uff09<\/strong>\u3092\u4f7f\u7528\u3057\u3066\u3001\u30d5\u30eb\u30d1\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u540d\uff08GetFileName \u30e1\u30bd\u30c3\u30c9\uff09\u3084\u30d1\u30b9\uff08GetParentFolderName \u30e1\u30bd\u30c3\u30c9\uff09\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002FileSystemObject\uff08FSO\uff09\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<h3>\u30d5\u30eb\u30d1\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u540d\u3092\u53d6\u5f97\uff08GetFileName \u30e1\u30bd\u30c3\u30c9\uff09<\/h3>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>GetFileName<\/strong> ( <em>pathspec<\/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>pathspec&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>\u623b\u308a\u5024&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5f15\u6570 <em>pathspec<\/em> \u3067\u6307\u5b9a\u3057\u305f\u30d1\u30b9\u306b\u3042\u308b\u6700\u5f8c\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08\u300c\u30d5\u30a9\u30eb\u30c0\u540d\u300d\u307e\u305f\u306f\u300c\u30d5\u30a1\u30a4\u30eb\u540d\u300d\uff09\u306e\u6587\u5b57\u5217\u3002<\/li>\n<\/ul>\n<br \/>\n<p class=\"caution8\"><strong>GetFileName \u30e1\u30bd\u30c3\u30c9<\/strong> \u306f\u3001\u5f15\u6570 <em>pathspec<\/em> \u3067\u6307\u5b9a\u3057\u305f\u30d1\u30b9\u304c\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b\u306f\u78ba\u8a8d\u3057\u307e\u305b\u3093\u3002<\/p>\n<\/p><\/div>\n<br \/>\n<h3>\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308b\uff08GetParentFolderName \u30e1\u30bd\u30c3\u30c9\uff09<\/h3>\n<br \/>\n<div class=\"kkbox\"><strong>\u3010\u66f8\u5f0f\u3011<\/strong><\/p>\n<p>    <em>object<\/em>.<strong>GetParentFolderName<\/strong> ( <em>path<\/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>path&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5bfe\u8c61\u3068\u306a\u308b\u30d1\u30b9\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<\/li>\n<li>\u623b\u308a\u5024&nbsp;&nbsp;\u30fb\u30fb\u30fb&nbsp;&nbsp;\u5f15\u6570 <em>path<\/em> \u3067\u6307\u5b9a\u3057\u305f\u30d1\u30b9\u306b\u3042\u308b\u6700\u5f8c\u306e\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\uff08\u300c\u30d5\u30a9\u30eb\u30c0\u540d\u300d\u307e\u305f\u306f\u300c\u30d5\u30a1\u30a4\u30eb\u540d\u300d\uff09\u306e\u89aa\u30d5\u30a9\u30eb\u30c0\u540d\u3092\u542b\u3080\u6587\u5b57\u5217\u3002<\/li>\n<\/ul>\n<br \/>\n<p class=\"caution8\">\u5f15\u6570 <em>path<\/em> \u3067\u6307\u5b9a\u3055\u308c\u305f\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306e\u89aa\u30d5\u30a9\u30eb\u30c0\u304c\u306a\u3044\u5834\u5408\u306f\u3001\u9577\u3055 0 \u306e\u6587\u5b57\u5217 (&#8220;&#8221;) \u3092\u8fd4\u3057\u307e\u3059\u3002<\/p>\n<p class=\"caution8\"><strong>GetParentFolderName \u30e1\u30bd\u30c3\u30c9<\/strong> \u306f\u3001\u5f15\u6570 <em>path<\/em> \u3067\u6307\u5b9a\u3057\u305f\u30d1\u30b9\u304c\u5b58\u5728\u3059\u308b\u304b\u3069\u3046\u304b\u306f\u78ba\u8a8d\u3057\u307e\u305b\u3093\u3002<\/p>\n<\/p><\/div>\n<br \/>\n<p class=\"caution4\">FSO\uff08FileSystemObject\uff09\u3092\u4f7f\u308f\u305a\u306b\u30d5\u30a1\u30a4\u30eb\u540d\u30fb\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/excelwork.info\/excel\/filegetpathname\/\">\u30d5\u30eb\u30d1\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u540d\u3001\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308b<\/a> \u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<\/div>\n<br \/><br \/>\n<h2>\u30d5\u30eb\u30d1\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u540d\u3084\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308b\u4f8b<\/h2>\n<div class=\"m30-l\">\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b91<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"GetFileName \u30e1\u30bd\u30c3\u30c9 \u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_GetFileName()\r\n\r\n    Dim fso As New FileSystemObject\r\n    Dim myPath1 As String, myPath2 As String\r\n    \r\n    myPath1 = \"c:\\newpath\\aaaa\\bbbb\\\"\r\n    myPath2 = \"c:\\newpath\\aaaa\\bbbb\\ccc.txt\"\r\n    \r\n    MsgBox \"myPath1:\" & fso.GetFileName(myPath1) & vbCrLf & _\r\n           \"myPath2:\" & fso.GetFileName(myPath2) & vbCrLf\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c1<\/h3>\n<p><a href=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/04\/fso_getfilename01.jpg?ssl=1\" rel=\"lightbox[5327]\"><img loading=\"lazy\" src=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/04\/fso_getfilename01.jpg?resize=168%2C170&#038;ssl=1\" alt=\"FSO GetFileName \u30e1\u30bd\u30c3\u30c9\" width=\"168\" height=\"170\" class=\"alignnone size-full wp-image-5329\" srcset=\"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/04\/fso_getfilename01.jpg?w=168&amp;ssl=1 168w, https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/04\/fso_getfilename01.jpg?resize=100%2C100&amp;ssl=1 100w\" sizes=\"(max-width: 168px) 100vw, 168px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<br \/>\n<h3 id=\"vba_sample\">\u30b5\u30f3\u30d7\u30ebVBA\u30bd\u30fc\u30b92<\/h3>\n<pre class=\"lang:vb mark:0 decode:true \" title=\"GetParentFolderName \u30e1\u30bd\u30c3\u30c9 \u4f7f\u7528\u4f8b\" data-url=\"http:\/\/example.co.jp\" >\r\n\u3000\r\nSub Sample_GetParentFolderName()\r\n\r\n    Dim fso As New FileSystemObject\r\n    Dim myPath1 As String, myPath2 As String\r\n    \r\n    myPath1 = \"c:\\newpath\\aaaa\\bbbb\\\"\r\n    myPath2 = \"c:\\newpath\\aaaa\\bbbb\\ccc.txt\"\r\n    \r\n    MsgBox \"myPath1:\" & fso.GetParentFolderName(myPath1) & vbCrLf & _\r\n           \"myPath2:\" & fso.GetParentFolderName(myPath2) & vbCrLf\r\n\r\nEnd Sub\r\n\u3000\r\n  <\/pre>\n<br \/>\n<h3>\u5b9f\u884c\u7d50\u679c2<\/h3>\n<p><a href=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/04\/fso_getparentfoldername.jpg?ssl=1\" rel=\"lightbox[5327]\"><img loading=\"lazy\" src=\"https:\/\/i2.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/04\/fso_getparentfoldername.jpg?resize=261%2C170&#038;ssl=1\" alt=\"FSO\u3000GetParentFolderName \u30e1\u30bd\u30c3\u30c9\" width=\"261\" height=\"170\" class=\"alignnone size-full wp-image-5330\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<\/div>\n<br \/><br \/>\n","protected":false},"excerpt":{"rendered":"<p>\u30d5\u30eb\u30d1\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u540d\u3084\u30d1\u30b9\u3092\u53d6\u5f97\u3059\u308b FileSystemObject\uff08FSO &#8230; <\/p>\n","protected":false},"author":1,"featured_media":5329,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"amp_status":"","spay_email":"","jetpack_publicize_message":""},"categories":[836],"tags":[721,693,722,846,845,834,63,38],"jetpack_featured_media_url":"https:\/\/i1.wp.com\/excelwork.info\/excel\/wp\/wp-content\/uploads\/2016\/04\/fso_getfilename01.jpg?fit=168%2C170&ssl=1","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4Ye9i-1nV","_links":{"self":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5327"}],"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=5327"}],"version-history":[{"count":3,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5327\/revisions"}],"predecessor-version":[{"id":5358,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/posts\/5327\/revisions\/5358"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media\/5329"}],"wp:attachment":[{"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/media?parent=5327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/categories?post=5327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/excelwork.info\/excel\/wp-json\/wp\/v2\/tags?post=5327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}