{"id":166,"date":"2024-10-29T00:15:28","date_gmt":"2024-10-28T15:15:28","guid":{"rendered":"https:\/\/anbtksh.com\/?p=166"},"modified":"2024-10-31T23:04:51","modified_gmt":"2024-10-31T14:04:51","slug":"166","status":"publish","type":"post","link":"https:\/\/anbtksh.com\/?p=166","title":{"rendered":""},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Sub \u30c6\u30b9\u30c8SQL\u4f5c\u6210()<br>Dim folderPath As String<br>Dim fso As Object<br>Dim folder As Object<br>Dim file As Object<br>Dim fileNameWithoutExt As String<br>Dim newFileName As String<br>Dim i As Integer<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'\u30d5\u30a9\u30eb\u30c0\u30d1\u30b9\u306e\u8a2d\u5b9a\nfolderPath = \"c:\\test\\\"\n\n'FileSystemObject\u306e\u4f5c\u6210\nSet fso = CreateObject(\"Scripting.FileSystemObject\")\nSet folder = fso.GetFolder(folderPath)\n\n'\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u3059\u3079\u3066\u306e.txt\u30d5\u30a1\u30a4\u30eb\u3092\u30eb\u30fc\u30d7\nFor Each file In folder.Files\n    If fso.GetExtensionName(file.Name) = \"txt\" Then\n        '\u30d5\u30a1\u30a4\u30eb\u540d\u304b\u3089\u62e1\u5f35\u5b50\u3092\u53d6\u308a\u9664\u304f\n        fileNameWithoutExt = Left(file.Name, Len(file.Name) - Len(fso.GetExtensionName(file.Name)) - 1)\n\n        '\u30b3\u30d4\u30fc\u30923\u3064\u4f5c\u6210\n        For i = 1 To 1\n            newFileName = folderPath &amp; fileNameWithoutExt &amp; \"_\" &amp; Format(i, \"00\") &amp; \".sql\"\n            fso.CopyFile file.Path, newFileName\n        Next i\n    End If\nNext file<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u5b8c\u6210\u7248<em>From\u53e5\u8907\u6570<\/em>\u661f\u30b3\u30e1\u30f3\u30c8\u3092\u30cf\u30a4\u30d5\u30f3\u306b_From\u53e5\u3060\u3051\u62bd\u51fa()<br>Dim folderPath As String<br>Dim fileName As String<br>Dim fileLine As String<br>Dim outputFilePath As String<br>Dim outputFile As Object<br>Dim fso As Object<br>Dim textFile As Object<br>Dim inCommentBlock As Boolean<br>Dim cleanLine As String<br>Dim lineNumber As Long<br>Dim finalContent As String<br>Dim inFromClause As Boolean<br>Dim concatenatedLine As String<br>Dim endPos As Long<br>Dim keywordPos As Long<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'\u30d5\u30a9\u30eb\u30c0\u30d1\u30b9\u306e\u8a2d\u5b9a\nfolderPath = \"c:\\test\\\"\n\n'FileSystemObject\u306e\u4f5c\u6210\nSet fso = CreateObject(\"Scripting.FileSystemObject\")\nfinalContent = \"\"\n\n'\u30d5\u30a9\u30eb\u30c0\u5185\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u30eb\u30fc\u30d7\nfileName = Dir(folderPath &amp; \"*.sql\")\nDo While fileName &lt;&gt; \"\"\n    '\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u8aad\u307f\u8fbc\u3080\n    Set textFile = fso.OpenTextFile(folderPath &amp; fileName, 1)\n    inCommentBlock = False\n    lineNumber = 0\n    inFromClause = False\n    concatenatedLine = \"\"\n\n    Do While Not textFile.AtEndOfStream\n        lineNumber = lineNumber + 1\n        fileLine = textFile.ReadLine\n        cleanLine = \" \" &amp; Replace(fileLine, vbTab, \" \")\n        cleanLine = Replace(cleanLine, \"  \", \" \")\n\n        '\u661f\u30b3\u30e1\u30f3\u30c8\u3092--\u30b3\u30e1\u30f3\u30c8\u306b\u5909\u63db\n        If InStr(cleanLine, \"\/*\") &gt; 0 Then\n            inCommentBlock = True\n        End If\n        If inCommentBlock Then\n            cleanLine = \"-- \" &amp; cleanLine\n            If InStr(cleanLine, \"*\/\") &gt; 0 Then\n                inCommentBlock = False\n            End If\n        End If\n\n        'FROM\u53e5\u3092\u542b\u3080\u884c\u3092\u691c\u51fa\n        If InStr(1, cleanLine, \" FROM \", vbTextCompare) &gt; 0 Then\n            inFromClause = True\n            concatenatedLine = fileName &amp; \"(\" &amp; lineNumber &amp; \"):\" &amp; Trim(cleanLine)\n        ElseIf inFromClause Then\n            '\u9023\u7d50\u3059\u308b\u30c6\u30fc\u30d6\u30eb\u540d\u3092\u62bd\u51fa\n            concatenatedLine = concatenatedLine &amp; \" \" &amp; Trim(cleanLine)\n        End If\n\n        'WHERE\u3001GROUP BY\u3001ORDER BY\u3001HAVING \u53e5\u4ee5\u964d\u3092\u7121\u8996\n        If inFromClause And (InStr(1, cleanLine, \" WHERE \", vbTextCompare) &gt; 0 Or _\n                             InStr(1, cleanLine, \" GROUP BY \", vbTextCompare) &gt; 0 Or _\n                             InStr(1, cleanLine, \" ORDER BY \", vbTextCompare) &gt; 0 Or _\n                             InStr(1, cleanLine, \" HAVING \", vbTextCompare) &gt; 0 Or _\n                             InStr(1, cleanLine, \";\", vbTextCompare) &gt; 0) Then\n            inFromClause = False\n            '\u7d42\u4e86\u4f4d\u7f6e\u3092\u6c7a\u5b9a\u3057\u3066\u53e5\u3092\u5207\u308a\u53d6\u308b\n            keywordPos = InStr(1, concatenatedLine, \" FROM \", vbTextCompare)\n            endPos = InStr(keywordPos + 5, concatenatedLine, \" WHERE \", vbTextCompare)\n            If endPos = 0 Then endPos = InStr(keywordPos + 5, concatenatedLine, \" GROUP BY \", vbTextCompare)\n            If endPos = 0 Then endPos = InStr(keywordPos + 5, concatenatedLine, \" ORDER BY \", vbTextCompare)\n            If endPos = 0 Then endPos = InStr(keywordPos + 5, concatenatedLine, \" HAVING \", vbTextCompare)\n            If endPos = 0 Then endPos = InStr(keywordPos + 5, concatenatedLine, \";\", vbTextCompare)\n            If endPos &gt; 0 Then\n                concatenatedLine = Left(concatenatedLine, endPos - 1)\n            End If\n            finalContent = finalContent &amp; concatenatedLine &amp; vbCrLf\n            concatenatedLine = \"\"\n        End If\n    Loop\n\n    textFile.Close\n    fileName = Dir\nLoop\n\n'\u7d50\u679c\u3092\u4e00\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u66f8\u304d\u8fbc\u3080\uff08\u51fa\u529b\u5148\u3092c:\\test2\u306b\u5909\u66f4\uff09\noutputFilePath = \"c:\\test2\\From\u62bd\u51fa.txt\"\nSet outputFile = fso.CreateTextFile(outputFilePath, True)\noutputFile.WriteLine finalContent\noutputFile.Close<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u66f8\u304d\u8fbc\u307f()<br>Dim shp As Shape<br>Dim i As Integer<br>Dim lastRow As Long<br>Dim firstLine As String<br>Dim secondLine As String<br>Dim pos As Long<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u30b7\u30fc\u30c8\u5185\u306e\u6700\u5f8c\u306e\u884c\u3092\u53d6\u5f97\nlastRow = ActiveSheet.Cells(rows.Count, \"K\").End(xlUp).Row\n\n' \u7a7a\u306e\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u306b\u5024\u3092\u57cb\u3081\u308b\ni = 1\nFor Each shp In ActiveSheet.Shapes\n    If shp.Type = msoTextBox Then\n        If shp.TextFrame.Characters.Text = \"\" Then\n            If i &lt;= lastRow Then\n                ' 1\u884c\u76ee\u30682\u884c\u76ee\u306e\u5185\u5bb9\u3092\u8a2d\u5b9a\n                firstLine = Cells(i, \"L\").Value\n                secondLine = Cells(i, \"M\").Value\n                shp.TextFrame.Characters.Text = firstLine &amp; vbCrLf &amp; secondLine\n\n                ' 1\u884c\u76ee\u306e\u30d5\u30a9\u30f3\u30c8\u8a2d\u5b9a\n                With shp.TextFrame.Characters(1, Len(firstLine)).Font\n                    .Name = \"Meiryo UI\"\n                    .Size = 11\n                End With\n\n                ' 2\u884c\u76ee\u306e\u30d5\u30a9\u30f3\u30c8\u8a2d\u5b9a\n                pos = Len(firstLine) + 2 ' 2\u884c\u76ee\u306e\u958b\u59cb\u4f4d\u7f6e\u3092\u8a2d\u5b9a\n                With shp.TextFrame.Characters(pos, Len(secondLine)).Font\n                    .Name = \"Meiryo UI\"\n                    .Size = 8\n                End With\n\n                ' \u30c6\u30ad\u30b9\u30c8\u3092\u4e2d\u592e\u63c3\u3048\u306b\u8a2d\u5b9a\n                shp.TextFrame.HorizontalAlignment = xlHAlignCenter\n\n                i = i + 1\n            Else\n                Exit For\n            End If\n        End If\n    End If\nNext shp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<br>Sub \u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u3092\u4f5c\u6210()<br>Dim originalShape As Shape<br>Dim newShape As Shape<br>Dim i As Integer, j As Integer<br>Dim horizontalSpacing As Single<br>Dim verticalSpacing As Single<br>Dim rows As Integer<br>Dim columns As Integer<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u884c\u3068\u5217\u306e\u6570\u3092\u5165\u529b\u3059\u308b\u305f\u3081\u306eInputBox\u3092\u8868\u793a\nrows = InputBox(\"\u4f55\u884c\u306b\u3057\u307e\u3059\u304b\uff1f\", \"\u884c\u306e\u8a2d\u5b9a\", 3)\ncolumns = InputBox(\"\u4f55\u5217\u306b\u3057\u307e\u3059\u304b\uff1f\", \"\u5217\u306e\u8a2d\u5b9a\", 3)\n\n' \u65b0\u3057\u3044\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u3092\u4f5c\u6210\nSet originalShape = ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 100, 100, 100, 50)\nWith originalShape.TextFrame.Characters.Font\n    .Name = \"Meiryo UI\"\n    .Size = 11 ' \u4efb\u610f\u306e\u521d\u671f\u30b5\u30a4\u30ba\nEnd With\n' \u5857\u308a\u3064\u3076\u3057\u306a\u3057\u3001\u7dda\u306e\u8272\u306f\u9ed2\u3001\u7dda\u306e\u592a\u3055\u306f0.75\u306b\u8a2d\u5b9a\nWith originalShape.line\n    .ForeColor.RGB = RGB(0, 0, 0)\n    .Weight = 0.75\nEnd With\noriginalShape.Fill.Transparency = 1\n\n' \u9593\u9694\u306e\u8a2d\u5b9a\nhorizontalSpacing = 20\nverticalSpacing = 10\n\n' \u6307\u5b9a\u3055\u308c\u305f\u884c\u3068\u5217\u3067\u8907\u88fd\nFor j = 0 To rows - 1\n    For i = 0 To columns - 1\n        If i &gt; 0 Or j &gt; 0 Then\n            ' \u8907\u88fd\u3092\u4f5c\u6210\n            Set newShape = originalShape.Duplicate\n            ' \u65b0\u3057\u3044\u4f4d\u7f6e\u3092\u8a2d\u5b9a\n            newShape.Left = originalShape.Left + (originalShape.Width + horizontalSpacing) * i\n            newShape.Top = originalShape.Top + (originalShape.Height + verticalSpacing) * j\n            ' \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30d5\u30a9\u30f3\u30c8\u3092\u8a2d\u5b9a\n            With newShape.TextFrame.Characters.Font\n                .Name = \"Meiryo UI\"\n                .Size = 11 ' \u4efb\u610f\u306e\u521d\u671f\u30b5\u30a4\u30ba\n            End With\n            ' \u5857\u308a\u3064\u3076\u3057\u306a\u3057\u3001\u7dda\u306e\u8272\u306f\u9ed2\u3001\u7dda\u306e\u592a\u3055\u306f0.75\u306b\u8a2d\u5b9a\n            With newShape.line\n                .ForeColor.RGB = RGB(0, 0, 0)\n                .Weight = 0.75\n            End With\n            newShape.Fill.Transparency = 1\n        End If\n    Next i\nNext j<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u30b7\u30a7\u30a4\u30d7\u3092\u4f5c\u6210()<br>Dim originalShape As Shape<br>Dim newShape As Shape<br>Dim i As Integer, j As Integer<br>Dim horizontalSpacing As Single<br>Dim verticalSpacing As Single<br>Dim rows As Integer<br>Dim columns As Integer<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u884c\u3068\u5217\u306e\u6570\u3092\u5165\u529b\u3059\u308b\u305f\u3081\u306eInputBox\u3092\u8868\u793a\nrows = InputBox(\"\u4f55\u884c\u306b\u3057\u307e\u3059\u304b\uff1f\", \"\u884c\u306e\u8a2d\u5b9a\", 3)\ncolumns = InputBox(\"\u4f55\u5217\u306b\u3057\u307e\u3059\u304b\uff1f\", \"\u5217\u306e\u8a2d\u5b9a\", 3)\n\n' \u65b0\u3057\u3044\u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u306e\u300c\u30c7\u30fc\u30bf\u300d\u30b7\u30a7\u30a4\u30d7\u3092\u4f5c\u6210\nSet originalShape = ActiveSheet.Shapes.AddShape(msoShapeFlowchartDocument, 100, 100, 100, 50)\nWith originalShape.TextFrame.Characters.Font\n    .Name = \"Meiryo UI\"\n    .Size = 11 ' \u4efb\u610f\u306e\u521d\u671f\u30b5\u30a4\u30ba\n    .Color = RGB(0, 0, 0) ' \u30c6\u30ad\u30b9\u30c8\u306e\u8272\u3092\u9ed2\u306b\u8a2d\u5b9a\nEnd With\n\n' \u5857\u308a\u3064\u3076\u3057\u306a\u3057\u3001\u7dda\u306e\u8272\u306f\u9ed2\u3001\u7dda\u306e\u592a\u3055\u306f0.75\u306b\u8a2d\u5b9a\nWith originalShape.line\n    .ForeColor.RGB = RGB(0, 0, 0)\n    .Weight = 0.75\nEnd With\noriginalShape.Fill.Transparency = 1\n\n' \u9593\u9694\u306e\u8a2d\u5b9a\nhorizontalSpacing = 20\nverticalSpacing = 10\n\n' \u6307\u5b9a\u3055\u308c\u305f\u884c\u3068\u5217\u3067\u8907\u88fd\nFor j = 0 To rows - 1\n    For i = 0 To columns - 1\n        If i &gt; 0 Or j &gt; 0 Then\n            ' \u8907\u88fd\u3092\u4f5c\u6210\n            Set newShape = originalShape.Duplicate\n            ' \u65b0\u3057\u3044\u4f4d\u7f6e\u3092\u8a2d\u5b9a\n            newShape.Left = originalShape.Left + (originalShape.Width + horizontalSpacing) * i\n            newShape.Top = originalShape.Top + (originalShape.Height + verticalSpacing) * j\n            ' \u30c7\u30d5\u30a9\u30eb\u30c8\u306e\u30d5\u30a9\u30f3\u30c8\u3068\u30c6\u30ad\u30b9\u30c8\u306e\u8272\u3092\u8a2d\u5b9a\n            With newShape.TextFrame.Characters.Font\n                .Name = \"Meiryo UI\"\n                .Size = 11 ' \u4efb\u610f\u306e\u521d\u671f\u30b5\u30a4\u30ba\n                .Color = RGB(0, 0, 0) ' \u30c6\u30ad\u30b9\u30c8\u306e\u8272\u3092\u9ed2\u306b\u8a2d\u5b9a\n            End With\n            ' \u5857\u308a\u3064\u3076\u3057\u306a\u3057\u3001\u7dda\u306e\u8272\u306f\u9ed2\u3001\u7dda\u306e\u592a\u3055\u306f0.75\u306b\u8a2d\u5b9a\n            With newShape.line\n                .ForeColor.RGB = RGB(0, 0, 0)\n                .Weight = 0.75\n            End With\n            newShape.Fill.Transparency = 1\n        End If\n    Next i\nNext j<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u30b7\u30a7\u30a4\u30d7\u306b\u30c6\u30ad\u30b9\u30c8\u66f8\u304d\u8fbc\u307f()<br>Dim shp As Shape<br>Dim i As Integer<br>Dim lastRow As Long<br>Dim firstLine As String<br>Dim secondLine As String<br>Dim pos As Long<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u30b7\u30fc\u30c8\u5185\u306e\u6700\u5f8c\u306e\u884c\u3092\u53d6\u5f97\nlastRow = ActiveSheet.Cells(rows.Count, \"K\").End(xlUp).Row\n\n' \u7a7a\u306e\u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u30b7\u30a7\u30a4\u30d7\u306b\u5024\u3092\u57cb\u3081\u308b\ni = 1\nFor Each shp In ActiveSheet.Shapes\n    ' \u30b7\u30a7\u30a4\u30d7\u306e\u540d\u524d\u306b \"Document\" \u304c\u542b\u307e\u308c\u3066\u3044\u308b\u5834\u5408\n    If shp.Name Like \"*Document*\" Then\n        If shp.TextFrame.Characters.Text = \"\" Then\n            If i &lt;= lastRow Then\n                ' 1\u884c\u76ee\u30682\u884c\u76ee\u306e\u5185\u5bb9\u3092\u8a2d\u5b9a\n                firstLine = Cells(i, \"L\").Value\n                secondLine = Cells(i, \"M\").Value\n                shp.TextFrame.Characters.Text = firstLine &amp; vbCrLf &amp; secondLine\n\n                ' 1\u884c\u76ee\u306e\u30d5\u30a9\u30f3\u30c8\u8a2d\u5b9a\n                With shp.TextFrame.Characters(1, Len(firstLine)).Font\n                    .Name = \"Meiryo UI\"\n                    .Size = 11\n                    .Color = RGB(0, 0, 0) ' \u6587\u5b57\u8272\u3092\u9ed2\u306b\u8a2d\u5b9a\n                End With\n\n                ' 2\u884c\u76ee\u306e\u30d5\u30a9\u30f3\u30c8\u8a2d\u5b9a\n                pos = Len(firstLine) + 2 ' 2\u884c\u76ee\u306e\u958b\u59cb\u4f4d\u7f6e\u3092\u8a2d\u5b9a\n                With shp.TextFrame.Characters(pos, Len(secondLine)).Font\n                    .Name = \"Meiryo UI\"\n                    .Size = 8\n                    .Color = RGB(0, 0, 0) ' \u6587\u5b57\u8272\u3092\u9ed2\u306b\u8a2d\u5b9a\n                End With\n\n                ' \u30c6\u30ad\u30b9\u30c8\u3092\u4e2d\u592e\u63c3\u3048\u306b\u8a2d\u5b9a\n                shp.TextFrame.HorizontalAlignment = xlHAlignCenter\n\n                i = i + 1\n            Else\n                Exit For\n            End If\n        End If\n    End If\nNext shp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2024.10.30<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u30b7\u30a7\u30a4\u30d7\u540d\u3092\u8a2d\u5b9a()<br>Dim shp As Shape<br>Dim ws As Worksheet<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u30a2\u30af\u30c6\u30a3\u30d6\u30b7\u30fc\u30c8\u3092\u8a2d\u5b9a\nSet ws = ActiveSheet\n\n' \u30b7\u30fc\u30c8\u5185\u306e\u5168\u3066\u306e\u30b7\u30a7\u30a4\u30d7\u3092\u30eb\u30fc\u30d7\nFor Each shp In ws.Shapes\n    If shp.TextFrame2.HasText Then\n        ' \u30b7\u30a7\u30a4\u30d7\u306e\u540d\u524d\u3092\u30c6\u30ad\u30b9\u30c8\u306b\u5909\u66f4\n        shp.Name = shp.TextFrame2.TextRange.Text\n    End If\nNext shp<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">End Sub<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2024.10.30<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u30b7\u30a7\u30a4\u30d7\u5185\u3092\u691c\u7d22()<br>Dim shp As Shape<br>Dim ws As Worksheet<br>Dim resultWs As Worksheet<br>Dim keyword As String<br>Dim found As Boolean<br>Dim resultRow As Long<br>Dim shapeFullName As String<br>Dim wb As Workbook<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' \u30ad\u30fc\u30ef\u30fc\u30c9\u3092InputBox\u3067\u5165\u529b\nkeyword = InputBox(\"\u691c\u7d22\u3057\u305f\u3044\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044:\")\n\n' \u691c\u7d22\u7d50\u679c\u304c\u898b\u3064\u304b\u3063\u305f\u304b\u3069\u3046\u304b\u306e\u30d5\u30e9\u30b0\nfound = False\n\n' \u30a2\u30af\u30c6\u30a3\u30d6\u30d6\u30c3\u30af\u3092\u8a2d\u5b9a\nSet wb = ActiveWorkbook\n\n' \u691c\u7d22\u7d50\u679c\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u3092\u4f5c\u6210\nOn Error Resume Next\nSet resultWs = wb.Sheets(\"\u691c\u7d22\u7d50\u679c\")\nOn Error GoTo 0\n\nIf resultWs Is Nothing Then\n    Set resultWs = wb.Sheets.Add(After:=wb.Sheets(wb.Sheets.Count))\n    resultWs.Name = \"\u691c\u7d22\u7d50\u679c\"\nElse\n    resultWs.Cells.Clear\nEnd If\n\nresultRow = 1\n\n' \u30a2\u30af\u30c6\u30a3\u30d6\u30b7\u30fc\u30c8\u3092\u8a2d\u5b9a\nSet ws = ActiveSheet\n\n' \u30b7\u30fc\u30c8\u5185\u306e\u5168\u3066\u306e\u30b7\u30a7\u30a4\u30d7\u3092\u30eb\u30fc\u30d7\nFor Each shp In ws.Shapes\n    If shp.TextFrame2.HasText Then\n        ' \u30b7\u30a7\u30a4\u30d7\u306e\u30c6\u30ad\u30b9\u30c8\u3092\u53d6\u5f97\u3057\u3001\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u691c\u7d22\n        If InStr(1, shp.TextFrame2.TextRange.Text, keyword, vbTextCompare) &gt; 0 Then\n            ' \u30b7\u30a7\u30a4\u30d7\u3092\u9078\u629e\n            shp.Select Replace:=False\n            ' \u30b7\u30a7\u30a4\u30d7\u540d\u3092\u300c\u30d6\u30c3\u30af\u540d-\u30b7\u30fc\u30c8\u540d-\u30b7\u30a7\u30a4\u30d7\u540d\u300d\u306e\u5f62\u5f0f\u306b\uff08\u30b7\u30fc\u30c8\u540d\u3068\u30b7\u30a7\u30a4\u30d7\u540d\u306e\u30a2\u30f3\u30c0\u30fc\u30d0\u30fc\u3092\u30cf\u30a4\u30d5\u30f3\u306b\u5909\u66f4\uff09\n            shapeFullName = wb.Name &amp; \"-\" &amp; Replace(ws.Name &amp; \"-\" &amp; shp.Name, \"_\", \"-\")\n            ' \u7d50\u679c\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306b\u8a18\u8ff0\n            resultWs.Cells(resultRow, 1).Value = shapeFullName\n            resultRow = resultRow + 1\n            found = True\n        End If\n    End If\nNext shp\n\n' \u30ad\u30fc\u30ef\u30fc\u30c9\u304c\u898b\u3064\u304b\u3063\u305f\u304b\u3069\u3046\u304b\u3092\u77e5\u3089\u305b\u308b\nIf found Then\n    MsgBox \"\u30ad\u30fc\u30ef\u30fc\u30c9 '\" &amp; keyword &amp; \"' \u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\u691c\u7d22\u7d50\u679c\u30b7\u30fc\u30c8\u3092\u78ba\u8a8d\u3057\u3066\u304f\u3060\u3055\u3044\u3002\"\nElse\n    MsgBox \"\u30ad\u30fc\u30ef\u30fc\u30c9 '\" &amp; keyword &amp; \"' \u306f\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002\"\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\">2024.10.31<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Sub \u30d5\u30ed\u30fc\u30c1\u30e3\u30fc\u30c8\u30b7\u30a7\u30a4\u30d7\u306b\u30c6\u30ad\u30b9\u30c8\u66f8\u304d\u8fbc\u307f_\u30d5\u30a9\u30f3\u30c8OK()<br>Dim shape As shape<br>Set shape = ActiveSheet.Shapes(&#8220;DOC1&#8221;) &#8216; \u3053\u3053\u3067 &#8220;YourShapeNameHere&#8221; \u3092\u5b9f\u969b\u306e\u30b7\u30a7\u30a4\u30d7\u540d\u306b\u7f6e\u304d\u63db\u3048\u307e\u3059<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>With shape.TextFrame2.TextRange\n    .Text = \"\u3007\u3007\u3007\u3007\u3007\u3007\u3007\u3007\" &amp; Chr(13) &amp; \"\u25b3\u25b3\u25b3\u25b3\u25b3\u25b3\u25b3\u25b3\" &amp; Chr(13) &amp; \"\u658e\u85e4\u3055\u3093\"\n\n    Dim charRanges As Variant\n    charRanges = Array(Array(1, 8), Array(9, 1), Array(10, 8), Array(18, 1), Array(19, 4))\n\n    Dim i As Integer\n    For i = LBound(charRanges) To UBound(charRanges)\n        With .Characters(charRanges(i)(0), charRanges(i)(1)).Font\n            .NameComplexScript = \"+mn-cs\"\n            .NameFarEast = \"Meiryo UI\"\n            .Fill.Visible = msoTrue\n            .Fill.ForeColor.ObjectThemeColor = msoThemeColorText1\n            .Fill.ForeColor.TintAndShade = 0\n            .Fill.ForeColor.Brightness = 0\n            .Fill.Transparency = 0\n            .Fill.Solid\n            .Size = 11\n            .Name = \"Meiryo UI\"\n        End With\n    Next i\n\n    ' \u6587\u5b57\u30b5\u30a4\u30ba\u306e\u8a2d\u5b9a\n    .Characters(10, 9).Font.Size = 8\n    .Characters(19, 4).Font.Size = 14\n\n    ' \u6bb5\u843d\u306e\u8a2d\u5b9a\n    .Characters(1, 9).ParagraphFormat.FirstLineIndent = 0\n    .Characters(1, 9).ParagraphFormat.Alignment = msoAlignLeft\n    .Characters(10, 9).ParagraphFormat.FirstLineIndent = 0\n    .Characters(10, 9).ParagraphFormat.Alignment = msoAlignLeft\n    .Characters(19, 4).ParagraphFormat.FirstLineIndent = 0\n    .Characters(19, 4).ParagraphFormat.Alignment = msoAlignLeft\nEnd With<\/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\u540d\u3092\u53d6\u5f97()<br>Dim shape As shape<br>For Each shape In ActiveSheet.Shapes<br>Debug.Print shape.Name<br>Next shape<br>End Sub<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sub \u30c6\u30b9\u30c8SQL\u4f5c\u6210()Dim folderPath As StringDim fso As ObjectDim folder As ObjectDim file As ObjectDim fileNameWitho &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/anbtksh.com\/?p=166\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;&#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-166","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts\/166","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=166"}],"version-history":[{"count":5,"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts\/166\/revisions"}],"predecessor-version":[{"id":180,"href":"https:\/\/anbtksh.com\/index.php?rest_route=\/wp\/v2\/posts\/166\/revisions\/180"}],"wp:attachment":[{"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anbtksh.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}