{"id":8670,"date":"2017-07-11T12:15:00","date_gmt":"2017-07-11T03:15:00","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=8670"},"modified":"2017-07-11T13:15:18","modified_gmt":"2017-07-11T04:15:18","slug":"%e3%80%902017%e5%b9%b47%e6%9c%88%e7%89%88%e3%80%91%e3%83%9d%e3%83%bc%e3%82%bf%e3%83%96%e3%83%ab-%e3%83%87%e3%83%90%e3%82%a4%e3%82%b9%e3%81%8b%e3%82%89%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=8670","title":{"rendered":"\u30102017\u5e747\u6708\u7248\u3011\u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308bVBA\u30de\u30af\u30ed"},"content":{"rendered":"<p>4\u5e74\u307b\u3069\u524d\u306b\u3001PC\u306b\u63a5\u7d9a\u3057\u305f\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u7b49\u306eWindows \u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3084\u30d5\u30a9\u30eb\u30c0\u3092\u30b3\u30d4\u30fc\u3059\u308b\u30de\u30af\u30ed\u306b\u3064\u3044\u3066\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3057\u305f\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=3681\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel-120x120.png' alt='\u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308bVBA\u30de\u30af\u30ed' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2013.09.30<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=3681\">\u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308bVBA\u30de\u30af\u30ed <\/a><\/div><div class=\"cardlink_excerpt\">moug\u306b\u3042\u3063\u305f\u8cea\u554f\u95a2\u9023\u306e\u30e1\u30e2\u3067\u3059\u3002\r\n\r\n\r\n\u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308b\u624b\u6bb5\u3068\u3057\u3066\u3001\u300cCopy\/Move Files from Portable Device\u300d\u3067\u306fShell\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u4f7f\u308f\u308c\u3066\u3044\u307e\u3057\u305f\u3002\r\n\r\n\u203b Copy\/Move F...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<p>\u5148\u65e5\u3001\u4e0a\u8a18\u30de\u30af\u30ed\u304cWindows 10 Creators Update\u74b0\u5883\u3067\u52d5\u4f5c\u3057\u306a\u304f\u306a\u3063\u305f\u3068\u306e\u30b3\u30e1\u30f3\u30c8\u3092\u3044\u305f\u3060\u3044\u305f\u306e\u3067\u3001\u30b3\u30fc\u30c9\u3092\u66f8\u304d\u76f4\u3059\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/p>\n<blockquote><p>\u3053\u306e\u30b3\u30fc\u30c9\u3092\u53c2\u8003\u306b\u30c7\u30b8\u30ab\u30e1\u30c7\u30fc\u30bf\u3092\u30b3\u30d4\u30fc\u3057\u3066\u3044\u307e\u3057\u305f\u304c\uff0cWindows10 1703\u3000Cretors update\u3000\u306b\u4e0a\u3052\u3066\u304b\u3089\uff0cNamespace\u306e\u90e8\u5206\u304c\u52d5\u304b\u304f\u306a\u304f\u306a\u308a\u307e\u3057\u305f\u3002<br \/>\nShell32.dll\u304c\uff0c2017\/6\/20\u306e\u30bf\u30a4\u30e0\u30b9\u30bf\u30f3\u30d7\u306b\u306a\u3063\u3066\u304a\u308a\uff0c\u5dee\u3057\u5909\u308f\u3063\u305f\u3053\u3068\u304c\u539f\u56e0\u3068\u63a8\u6e2c\u3057\u307e\u3059\u3002<br \/>\n\u8272\u3005\u30c8\u30e9\u30a4\u3057\u307e\u3057\u305f\u304c\uff0c\u56de\u907f\u7b56\u304c\u306a\u304f\u3066\u56f0\u3063\u3066\u3044\u307e\u3059\u3002<\/p><\/blockquote>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub Sample()\r\n  CopyWpdItems &quot;\u5185\u90e8\u30b9\u30c8\u30ec\u30fc\u30b8\\data\\jp.co.yahoo.android.yjwidget_sbm&quot;, _\r\n               &quot;C:\\Test\\WPD&quot;, _\r\n               &quot;Xperia Z Ultra&quot;\r\n  MsgBox &quot;\u51e6\u7406\u304c\u7d42\u4e86\u3057\u307e\u3057\u305f\u3002&quot;, vbInformation + vbSystemModal\r\nEnd Sub\r\n\r\nPrivate Sub CopyWpdItems(ByVal SrcFolderPath As String, _\r\n                         ByVal TargetFolderPath As Variant, _\r\n                         Optional ByVal WpdName As String = &quot;&quot;)\r\n'Windows \u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9(WPD)\u306b\u3042\u308b\u30d5\u30a9\u30eb\u30c0\u306e\u4e2d\u8eab\u3092\u6307\u5b9a\u3057\u305f\u30d5\u30a9\u30eb\u30c0\u306b\u30b3\u30d4\u30fc\r\n'- SrcFolderPath:\u30b3\u30d4\u30fc\u5143\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9\r\n'- TargetFolderPath:\u30b3\u30d4\u30fc\u5148\u30d5\u30a9\u30eb\u30c0\u306e\u30d1\u30b9\r\n'- WpdName:WPD\u540d(\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308bWPD\u304c\u4e00\u3064\u3057\u304b\u306a\u3044\u5834\u5408\u306f\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u7121\u3057)\r\n  Dim Wpd As Object\r\n  Dim ParentFolder As Object\r\n  Dim Srcfolder As Object\r\n  Dim TargetFolder As Object\r\n  Dim itm As Object\r\n  Dim v As Variant\r\n  Dim i As Long\r\n  \r\n  '\u30b3\u30d4\u30fc\u5148\u30d5\u30a9\u30eb\u30c0\u30c1\u30a7\u30c3\u30af\r\n  With CreateObject(&quot;Scripting.FileSystemObject&quot;)\r\n    If .FolderExists(TargetFolderPath) = False Then\r\n      MsgBox &quot;\u30b3\u30d4\u30fc\u5148\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot; &amp; vbNewLine &amp; _\r\n             &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbCritical + vbSystemModal\r\n      Exit Sub\r\n    End If\r\n  End With\r\n  \r\n  'WPD\u53d6\u5f97\r\n  Set Wpd = GetWpd(WpdName)\r\n  If Wpd Is Nothing Then\r\n    MsgBox &quot;\u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9\u3092\u53d6\u5f97\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002&quot; &amp; vbNewLine &amp; _\r\n           &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbCritical + vbSystemModal\r\n    Exit Sub\r\n  End If\r\n  Set ParentFolder = Wpd\r\n  \r\n  '\u30b3\u30d4\u30fc\u5143\u30d5\u30a9\u30eb\u30c0\u53d6\u5f97\r\n  v = Split(SrcFolderPath, ChrW(&amp;H5C))\r\n  For i = LBound(v) To UBound(v)\r\n    Set Srcfolder = GetWpdChildFolder(ParentFolder, v(i))\r\n    If Srcfolder Is Nothing Then\r\n      MsgBox &quot;\u30b3\u30d4\u30fc\u5bfe\u8c61\u306e\u30d5\u30a9\u30eb\u30c0\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002&quot; &amp; vbNewLine &amp; _\r\n             &quot;\u51e6\u7406\u3092\u4e2d\u6b62\u3057\u307e\u3059\u3002&quot;, vbCritical + vbSystemModal\r\n      Exit Sub\r\n    End If\r\n    Set ParentFolder = Srcfolder\r\n  Next\r\n  \r\n  '\u30d5\u30a1\u30a4\u30eb\/\u30d5\u30a9\u30eb\u30c0\u30b3\u30d4\u30fc\r\n  With CreateObject(&quot;Shell.Application&quot;)\r\n    Set TargetFolder = .Namespace(TargetFolderPath)\r\n    On Error Resume Next\r\n    For Each itm In Srcfolder.Items\r\n      TargetFolder.CopyHere itm '\u30d5\u30a9\u30eb\u30c0\u30fc\u542b\u3081\u3066\u30b3\u30d4\u30fc\r\n    Next\r\n    If Err.Number &lt;&gt; 0 Then\r\n      MsgBox &quot;\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002&quot; &amp; vbNewLine &amp; vbNewLine &amp; _\r\n             &quot;\u30a8\u30e9\u30fc\u756a\u53f7\uff1a&quot; &amp; Err.Number &amp; vbNewLine &amp; _\r\n             &quot;\u30a8\u30e9\u30fc\u5185\u5bb9\uff1a&quot; &amp; Err.Description, vbCritical + vbSystemModal\r\n    End If\r\n    On Error GoTo 0\r\n  End With\r\nEnd Sub\r\n\r\nPrivate Function GetWpd(Optional ByVal WpdName As String = &quot;&quot;) As Object\r\n'Windows \u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9(WPD)\u3092\u53d6\u5f97\r\n'\u203bWPD\u304c\u8907\u6570\u63a5\u7d9a\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u5f15\u6570\u3067\u540d\u524d\u3092\u6307\u5b9a\r\n  Dim ret As Object\r\n  Dim itm As Object\r\n  \r\n  Set ret = Nothing '\u521d\u671f\u5316\r\n  With CreateObject(&quot;Shell.Application&quot;).Namespace(&quot;shell:MyComputerFolder&quot;)\r\n    For Each itm In .Items\r\n      Select Case itm.Type\r\n        Case &quot;\u30dd\u30fc\u30bf\u30d6\u30eb \u30e1\u30c7\u30a3\u30a2 \u30d7\u30ec\u30fc\u30e4\u30fc&quot;, &quot;\u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9&quot;\r\n          If Len(Trim(WpdName)) &lt; 1 Then\r\n            Set ret = itm.GetFolder\r\n          Else\r\n            If itm.Name = WpdName Then\r\n              Set ret = itm.GetFolder\r\n            End If\r\n          End If\r\n      End Select\r\n    Next\r\n  End With\r\n  Set GetWpd = ret\r\nEnd Function\r\n\r\nPrivate Function GetWpdChildFolder(ByVal ParentFolder As Object, _\r\n                                   ByVal ChildFolderName As String) As Object\r\n  Dim ret As Object\r\n  Dim itm As Object\r\n  \r\n  Set ret = Nothing '\u521d\u671f\u5316\r\n  For Each itm In ParentFolder.Items\r\n    If (itm.IsFolder = True) And (itm.Name = ChildFolderName) Then\r\n      Set ret = itm.GetFolder\r\n      Exit For\r\n    End If\r\n  Next\r\n  Set GetWpdChildFolder = ret\r\nEnd Function<\/pre>\n<p>FolderItem\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306eType\u30d7\u30ed\u30d1\u30c6\u30a3\u306b\u3088\u3063\u3066\u30dd\u30fc\u30bf\u30d6\u30eb \u30e1\u30c7\u30a3\u30a2 \u30d7\u30ec\u30fc\u30e4\u30fc(\u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9)\u304b\u3069\u3046\u304b\u3092\u5224\u5225\u3057\u3066\u76ee\u7684\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u53d6\u5f97\u3001Folder\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306eCopyHere\u30e1\u30bd\u30c3\u30c9\u306b\u3088\u3063\u3066\u30d5\u30a1\u30a4\u30eb\u3084\u30d5\u30a9\u30eb\u30c0\u306e\u30b3\u30d4\u30fc\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>Windows \u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9\u4e0a\u306e\u30d5\u30a1\u30a4\u30eb\u3084\u30d5\u30a9\u30eb\u30c0\u3092\u30de\u30af\u30ed\u304b\u3089\u64cd\u4f5c\u3057\u305f\u3044\u5834\u5408\u306b\u306f\u3001\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u53c2\u8003\u306b\u3057\u3066\u3044\u305f\u3060\u3051\u308c\u3070\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"4\u5e74\u307b\u3069\u524d\u306b\u3001PC\u306b\u63a5\u7d9a\u3057\u305f\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u7b49\u306eWindows \u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3084\u30d5\u30a9\u30eb\u30c0\u3092\u30b3\u30d4\u30fc\u3059\u308b\u30de\u30af\u30ed\u306b\u3064\u3044\u3066\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3057\u305f\u3002 \u5148\u65e5\u3001\u4e0a\u8a18\u30de\u30af\u30ed\u304cWindows 10 Creators Update [&hellip;]","protected":false},"author":1,"featured_media":7120,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[\u30102017\u5e747\u6708\u7248\u3011\u30dd\u30fc\u30bf\u30d6\u30eb \u30c7\u30d0\u30a4\u30b9\u304b\u3089\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc\u3059\u308bVBA\u30de\u30af\u30ed]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,48,49,58],"tags":[],"class_list":["post-8670","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-word-office","category-powerpoint"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-OfficeVBA.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-2fQ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8670"}],"version-history":[{"count":2,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8670\/revisions"}],"predecessor-version":[{"id":8672,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8670\/revisions\/8672"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7120"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8670"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8670"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}