{"id":197,"date":"2024-11-16T06:54:56","date_gmt":"2024-11-15T21:54:56","guid":{"rendered":"https:\/\/anbtksh.com\/?p=197"},"modified":"2024-11-16T06:54:57","modified_gmt":"2024-11-15T21:54:57","slug":"%e6%8c%87%e5%ae%9a%e3%81%97%e3%81%9f%e3%83%96%e3%83%83%e3%82%af%e4%b8%8a%e3%81%ae%e5%85%a8%e3%82%b7%e3%82%a7%e3%82%a4%e3%83%97%e5%86%85%e3%81%ae%e3%83%86%e3%82%ad%e3%82%b9%e3%83%88%e3%81%ae%e4%b8%80","status":"publish","type":"post","link":"https:\/\/anbtksh.com\/?p=197","title":{"rendered":"\u6307\u5b9a\u3057\u305f\u30d6\u30c3\u30af\u4e0a\u306e\u5168\u30b7\u30a7\u30a4\u30d7\u5185\u306e\u30c6\u30ad\u30b9\u30c8\u306e\u4e00\u89a7\u3068\u3001\u30b9\u30da\u30fc\u30b9\u307e\u3067\u306e\uff08\u30b9\u30da\u30fc\u30b9\u3092\u542b\u3080\uff09\u6587\u5b57\u3092\u524a\u9664"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Sub \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A()<br>Dim ws As Worksheet<br>Dim outputWs As Worksheet<br>Dim targetShape As shape<br>Dim row As Long<br>Dim workbookPath As String<br>Dim targetWb As Workbook<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u30d6\u30c3\u30af\u306e\u30d5\u30eb\u30d1\u30b9\u3092\u53d6\u5f97\nworkbookPath = InputBox(\"\u64cd\u4f5c\u5bfe\u8c61\u306b\u306a\u308b\u30d6\u30c3\u30af\u306e\u30d5\u30eb\u30d1\u30b9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\", \"\u30d6\u30c3\u30af\u306e\u9078\u629e\")\n\n' \u30d6\u30c3\u30af\u3092\u958b\u304f\nSet targetWb = Workbooks.Open(workbookPath)\n\n' \u65e2\u5b58\u306e\u30b7\u30a7\u30a4\u30d7\u306e\u4e00\u89a7\u30b7\u30fc\u30c8\u3092\u524a\u9664\nApplication.DisplayAlerts = False\nOn Error Resume Next\nSet outputWs = targetWb.sheets(\"\u30b7\u30a7\u30a4\u30d7\u306e\u4e00\u89a7\")\nIf Not outputWs Is Nothing Then\n    outputWs.Delete\nEnd If\nOn Error GoTo 0\nApplication.DisplayAlerts = True\n\n' \u7d50\u679c\u3092\u51fa\u529b\u3059\u308b\u65b0\u3057\u3044\u30b7\u30fc\u30c8\u3092\u4f5c\u6210\nSet outputWs = targetWb.sheets.Add\noutputWs.Name = \"\u30b7\u30a7\u30a4\u30d7\u306e\u4e00\u89a7\"\n\n' \u898b\u51fa\u3057\u3092\u8a2d\u5b9a\noutputWs.Cells(1, 1).Value = \"\u30b7\u30fc\u30c8\u540d\"\noutputWs.Cells(1, 2).Value = \"\u30b0\u30eb\u30fc\u30d7\u540d\"\noutputWs.Cells(1, 3).Value = \"\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u540d\"\noutputWs.Cells(1, 4).Value = \"\u30c6\u30ad\u30b9\u30c8\"\n\n' \u898b\u51fa\u3057\u306e\u66f8\u5f0f\u8a2d\u5b9a\nWith outputWs.Range(\"A1:D1\")\n    .Interior.Color = RGB(255, 255, 0) ' \u80cc\u666f\u3092\u9ec4\u8272\u306b\u8a2d\u5b9a\n    .HorizontalAlignment = xlCenter ' \u30bb\u30f3\u30bf\u30ea\u30f3\u30b0\n    .Font.Bold = False\nEnd With\n\n' 1\u884c\u76ee\u3092\u56fa\u5b9a\noutputWs.rows(\"2:2\").Select\nActiveWindow.FreezePanes = True\n\nrow = 2\n\n' \u5404\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3092\u30eb\u30fc\u30d7\nFor Each ws In targetWb.Worksheets\n    ' \u5404\u30b7\u30a7\u30a4\u30d7\u3092\u30eb\u30fc\u30d7\n    For Each targetShape In ws.Shapes\n        Call \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A_1(targetShape, outputWs, row, \"\", ws.Name)\n    Next targetShape\nNext ws\n\n' \u30bb\u30eb\u5e45\u3092\u6700\u9069\u5316\noutputWs.columns(\"A:D\").AutoFit<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A_1(targetShape As shape, outputWs As Worksheet, ByRef row As Long, groupName As String, sheetName As String)<br>Dim i As Long<br>Dim shapeName As String<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>shapeName = targetShape.Name\n\n' \u30b0\u30eb\u30fc\u30d7\u5316\u3055\u308c\u305f\u30b7\u30a7\u30a4\u30d7\u306e\u5834\u5408\nIf targetShape.Type = msoGroup Then\n    For i = 1 To targetShape.GroupItems.Count\n        Call \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A_1(targetShape.GroupItems(i), outputWs, row, shapeName, sheetName)\n    Next i\nElse\n    ' \u30c6\u30ad\u30b9\u30c8\u304c\u3042\u308b\u5834\u5408\n    If targetShape.TextFrame2.HasText Then\n        outputWs.Cells(row, 1).Value = sheetName\n        outputWs.Cells(row, 2).Value = groupName\n        outputWs.Cells(row, 3).Value = shapeName\n        outputWs.Cells(row, 4).Value = targetShape.TextFrame2.textRange.Text\n        row = row + 1\n    End If\nEnd If<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u30b7\u30a7\u30a4\u30d7\u5185\u306e\u30b9\u30da\u30fc\u30b9\u307e\u3067\u3092\u524a\u9664()<br>Dim ws As Worksheet<br>Dim targetShape As shape<br>Dim workbookPath As String<br>Dim targetWb As Workbook<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u30d6\u30c3\u30af\u306e\u30d5\u30eb\u30d1\u30b9\u3092\u53d6\u5f97\nworkbookPath = InputBox(\"\u64cd\u4f5c\u5bfe\u8c61\u306b\u306a\u308b\u30d6\u30c3\u30af\u306e\u30d5\u30eb\u30d1\u30b9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\", \"\u30d6\u30c3\u30af\u306e\u9078\u629e\")\n\n' \u30d6\u30c3\u30af\u3092\u958b\u304f\nSet targetWb = Workbooks.Open(workbookPath)\n\n' \u5404\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3092\u30eb\u30fc\u30d7\nFor Each ws In targetWb.Worksheets\n    ' \u5404\u30b7\u30a7\u30a4\u30d7\u3092\u30eb\u30fc\u30d7\n    For Each targetShape In ws.Shapes\n        Call \u524a\u9664\u30d7\u30ed\u30bb\u30b9(targetShape)\n    Next targetShape\nNext ws<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u524a\u9664\u30d7\u30ed\u30bb\u30b9(targetShape As shape)<br>Dim i As Long<br>Dim shapeText As String<br>Dim spacePosition As Long<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u30b0\u30eb\u30fc\u30d7\u5316\u3055\u308c\u305f\u30b7\u30a7\u30a4\u30d7\u306e\u5834\u5408\nIf targetShape.Type = msoGroup Then\n    For i = 1 To targetShape.GroupItems.Count\n        Call \u524a\u9664\u30d7\u30ed\u30bb\u30b9(targetShape.GroupItems(i))\n    Next i\nElse\n    ' \u30c6\u30ad\u30b9\u30c8\u304c\u3042\u308b\u5834\u5408\n    If targetShape.TextFrame2.HasText Then\n        shapeText = targetShape.TextFrame2.textRange.Text\n\n        ' \u534a\u89d2\u30b9\u30da\u30fc\u30b9\u3068\u5168\u89d2\u30b9\u30da\u30fc\u30b9\u3092\u3059\u3079\u3066\u524a\u9664\n        Do\n            spacePosition = InStr(shapeText, \" \")\n            If spacePosition &gt; 0 Then\n                shapeText = Mid(shapeText, spacePosition + 1)\n            End If\n        Loop While spacePosition &gt; 0\n\n        Do\n            spacePosition = InStr(shapeText, \"\u3000\")\n            If spacePosition &gt; 0 Then\n                shapeText = Mid(shapeText, spacePosition + 1)\n            End If\n        Loop While spacePosition &gt; 0\n\n        targetShape.TextFrame2.textRange.Text = shapeText\n    End If\nEnd If<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sub \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u4e00\u89a7A()Dim ws As WorksheetDim outputWs As WorksheetDim targetShape As shapeDim row As LongDim workb &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/anbtksh.com\/?p=197\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;\u6307\u5b9a\u3057\u305f\u30d6\u30c3\u30af\u4e0a\u306e\u5168\u30b7\u30a7\u30a4\u30d7\u5185\u306e\u30c6\u30ad\u30b9\u30c8\u306e\u4e00\u89a7\u3068\u3001\u30b9\u30da\u30fc\u30b9\u307e\u3067\u306e\uff08\u30b9\u30da\u30fc\u30b9\u3092\u542b\u3080\uff09\u6587\u5b57\u3092\u524a\u9664&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-197","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts\/197","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=197"}],"version-history":[{"count":1,"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts\/197\/revisions"}],"predecessor-version":[{"id":198,"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts\/197\/revisions\/198"}],"wp:attachment":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=197"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=197"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=197"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}