{"id":5277,"date":"2021-12-17T02:29:55","date_gmt":"2021-12-17T02:29:55","guid":{"rendered":"https:\/\/lacotasu.com\/?p=5277"},"modified":"2022-01-02T13:33:04","modified_gmt":"2022-01-02T13:33:04","slug":"%e3%80%90%e5%82%99%e5%bf%98%e9%8c%b2%e3%80%91excel%e3%81%a7%e8%a4%87%e6%95%b0%e3%81%ae%e5%88%97%e3%82%92%e3%82%bd%e3%83%bc%e3%83%88%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95%e3%80%90winactor%e3%80%91","status":"publish","type":"post","link":"https:\/\/lacotasu.com\/?p=5277","title":{"rendered":"\u3010\u5099\u5fd8\u9332\u3011Excel\u3067\u8907\u6570\u306e\u5217\u3092\u30bd\u30fc\u30c8\u3059\u308b\u65b9\u6cd5\u3010WinActor\u3011"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">\u524d\u63d0\u6761\u4ef6\u3068\u76ee\u6a19<\/h2>\n\n\n\n<p>\u2193 \u3053\u3046\u3044\u3046Excel\u304c\u3042\u3063\u305f\u3068\u3059\u308b\u3002<br> \u8907\u6570\u306e\u5217\u3067\u4e26\u3073\u66ff\u3048\u305f\u3044\u3002 <\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"722\" src=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-79.png\" alt=\"\" class=\"wp-image-5284\" srcset=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-79.png 721w, https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-79-300x300.png 300w, https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-79-150x150.png 150w, https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-79-100x100.png 100w\" sizes=\"auto, (max-width: 721px) 100vw, 721px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6700\u521d\u304b\u3089\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3053\u306e\u30ce\u30fc\u30c9\u3092\u3061\u3087\u3053\u3063\u3068\u4fee\u6b63\u3057\u305f<\/h2>\n\n\n\n<p>\u3053\u306e\u307e\u307e\u3060\u3068\u4e00\u3064\u306e\u9805\u76ee\u3067\u3057\u304b\u4e26\u3073\u66ff\u3048\u3067\u304d\u306a\u3044\u3002<br>\u8907\u6570\u306e\u5217\u3067\u4e26\u3073\u66ff\u3048\u305f\u3044\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"365\" height=\"542\" src=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-73.png\" alt=\"\" class=\"wp-image-5281\" srcset=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-73.png 365w, https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-73-202x300.png 202w\" sizes=\"auto, (max-width: 365px) 100vw, 365px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"614\" height=\"869\" src=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-74.png\" alt=\"\" class=\"wp-image-5282\" srcset=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-74.png 614w, https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-74-212x300.png 212w\" sizes=\"auto, (max-width: 614px) 100vw, 614px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"625\" height=\"564\" src=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-78.png\" alt=\"\" class=\"wp-image-5283\" srcset=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-78.png 625w, https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-78-300x271.png 300w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\u4ee5\u4e0b\u8d64\u5b57\u304c\u8ffd\u52a0\u4fee\u6b63\u3057\u305f\u30b3\u30fc\u30c9\uff08\u30bd\u30fc\u30c8\u3057\u305f\u3044\u5217\u304c2\u3064\u306e\u4f8b\uff09<\/h2>\n\n\n\n<p>' ====\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f====================================================<\/p>\n\n\n\n<p>' \u30d5\u30a1\u30a4\u30eb\u306e\u30d1\u30b9\u3092\u30d5\u30eb\u30d1\u30b9\u306b\u5909\u63db\u3059\u308b<br>fname = !\u30d5\u30a1\u30a4\u30eb\u540d!<br>SetUMSVariable \"$FILE_PATH_TYPE\", \"1\"<br>SetUmsVariable \"$PARSE_FILE_PATH\", fname<br>filePath = GetUmsVariable(\"$PARSE_FILE_PATH\")<\/p>\n\n\n\n<p>' workbook\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u53d6\u5f97\u3059\u308b<br>Set workbook = Nothing<br>On Error Resume Next<br>' \u65e2\u5b58\u306e\u30a8\u30af\u30bb\u30eb\u304c\u8d77\u52d5\u3055\u308c\u3066\u3044\u308c\u3070\u8b66\u544a\u3092\u6291\u5236\u3059\u308b<br>Set existingXlsApp = Nothing<br>Set existingXlsApp = GetObject(, \"Excel.Application\")<br>existingXlsApp.DisplayAlerts = False<\/p>\n\n\n\n<p>' \u4e00\u5148\u305aWorkbook\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092GetObject\u3057\u3066\u307f\u308b<br>Set workbook = GetObject(filePath)<br>Set xlsApp = workbook.Parent<\/p>\n\n\n\n<p>' GetObject\u306b\u3088\u3063\u3066\u65b0\u898f\u306b\u958b\u304b\u308c\u305fWorkbook\u306a\u3089<br>' \u5909\u6570\u306bNothing\u3092\u4ee3\u5165\u3059\u308b\u3053\u3068\u3067\u53c2\u7167\u304c0\u306b\u306a\u308b\u305f\u3081<br>' \u81ea\u52d5\u7684\u306b\u9589\u3058\u3089\u308c\u308b\u3002<br>Set workbook = Nothing<\/p>\n\n\n\n<p>' Workbook\u304c\u307e\u3060\u5b58\u5728\u3059\u308b\u304b\u78ba\u8a8d\u3059\u308b<br>For Each book In xlsApp.Workbooks<br>If UCase(book.FullName) = UCase(filePath) Then<br>' Workbook\u304c\u307e\u3060\u5b58\u5728\u3059\u308b\u306e\u3067\u3001\u3053\u306eWorkbook\u306f\u65e2\u306b\u958b\u304b\u308c\u3066\u3044\u305f\u3082\u306e<br>Set workbook = book<br>xlsApp.Visible = True<br>End If<br>Next<\/p>\n\n\n\n<p>' Workbook\u304c\u5b58\u5728\u3057\u306a\u3044\u5834\u5408\u306f\u3001\u65b0\u305f\u306b\u958b\u304f\u3002<br>If workbook Is Nothing Then<br>Set xlsApp = Nothing<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>' Excel\u304c\u65e2\u306b\u958b\u304b\u308c\u3066\u3044\u305f\u306a\u3089\u305d\u308c\u3092\u518d\u5229\u7528\u3059\u308b\nIf Not existingXlsApp Is Nothing Then\n  Set xlsApp = existingXlsApp\n  xlsApp.Visible = True\nElse\n  Set xlsApp = CreateObject(\"Excel.Application\")\n  xlsApp.Visible = True\nEnd If\n\nSet workbook = xlsApp.Workbooks.Open(filePath)<\/code><\/pre>\n\n\n\n<p>End If<\/p>\n\n\n\n<p>' \u8b66\u544a\u306e\u6291\u5236\u3092\u5143\u306b\u623b\u3059<br>existingXlsApp.DisplayAlerts = True<br>Set existingXlsApp = Nothing<br>On Error Goto 0<\/p>\n\n\n\n<p>If workbook Is Nothing Then<br>Err.Raise 1, \"\", \"\u6307\u5b9a\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u305b\u3093\u3002\"<br>End If<\/p>\n\n\n\n<p>' ====\u6307\u5b9a\u3055\u308c\u305f\u30b7\u30fc\u30c8\u3092\u53d6\u5f97\u3059\u308b==================================================<\/p>\n\n\n\n<p>sheetName = !\u30b7\u30fc\u30c8\u540d!<br>Set worksheet = Nothing<br>On Error Resume Next<br>' \u30b7\u30fc\u30c8\u540d\u304c\u6307\u5b9a\u3055\u308c\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u30a2\u30af\u30c6\u30a3\u30d6\u30b7\u30fc\u30c8\u3092\u5bfe\u8c61\u3068\u3059\u308b<br>If sheetName = \"\" Then<br>Set worksheet = workbook.ActiveSheet<br>Else<br>Set worksheet = workbook.Worksheets(sheetName)<br>End If<br>On Error Goto 0<\/p>\n\n\n\n<p>If worksheet Is Nothing Then<br>Err.Raise 1, \"\", \"\u6307\u5b9a\u3055\u308c\u305f\u30b7\u30fc\u30c8\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002\"<br>End If<\/p>\n\n\n\n<p>worksheet.Activate<\/p>\n\n\n\n<p>' ====\u30cf\u30a4\u30e9\u30a4\u30c8\u3092\u8868\u793a\u3059\u308b========================================================<\/p>\n\n\n\n<p>' Hwnd\u30d7\u30ed\u30d1\u30c6\u30a3\u306fExcel2002\u4ee5\u964d\u306e\u307f\u5bfe\u5fdc<br>On Error Resume Next<br>ShowUMSHighlight(xlsApp.Hwnd)<br>On Error Goto 0<\/p>\n\n\n\n<p>' ==============================================================<\/p>\n\n\n\n<p>scell = !\u958b\u59cb\u30bb\u30eb!<br>ecell = !\u7d42\u4e86\u30bb\u30eb!<br><strong><span class=\"has-inline-color has-vivid-red-color\">cellAddress1 = !\u30bd\u30fc\u30c8\u30ad\u30fc\u306e\u30bb\u30eb\u4f4d\u7f6e1!<br>cellAddress2 = !\u30bd\u30fc\u30c8\u30ad\u30fc\u306e\u30bb\u30eb\u4f4d\u7f6e2!<\/span><\/strong><br><span class=\"has-inline-color has-vivid-red-color\"><strong>orderStr1 = !\u4e26\u3073\u66ff\u3048\u9806\u5e8f1|\u6607\u9806,\u964d\u9806!<br>orderStr2 = !\u4e26\u3073\u66ff\u3048\u9806\u5e8f2|\u6607\u9806,\u964d\u9806!<\/strong><\/span><br>headerStr = !1\u884c\u76ee\u306e\u6271\u3044|\u898b\u51fa\u3057\u3068\u3057\u306a\u3044,\u898b\u51fa\u3057\u3068\u3059\u308b,\u81ea\u52d5\u5224\u5225!<br><strong><span class=\"has-inline-color has-vivid-red-color\">order1 = 1<br>order2 = 1<\/span><\/strong><br>header = 2<\/p>\n\n\n\n<p><span class=\"has-inline-color has-vivid-red-color\"><strong>If orderStr1 = \"\u6607\u9806\" Then<br>order1 = 1<br>Else<br>order1 = 2<br>End If<\/strong><\/span><\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">If orderStr2 = \"\u6607\u9806\" Then<\/span><\/strong><br><strong><span class=\"has-inline-color has-vivid-red-color\">order2 = 1<br>Else<br>order2 = 2<br>End If<\/span><\/strong><\/p>\n\n\n\n<p>If headerStr = \"\u81ea\u52d5\u5224\u5225\" Then<br>header = 0<br>ElseIf headerStr = \"\u898b\u51fa\u3057\u3068\u3059\u308b\" Then<br>header = 1<br>Else<br>header = 2<br>End If<\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">Set cell1 = Nothing<br>Set cell2 = Nothing<\/span><\/strong><br>On Error Resume Next<br>' R1C1\u5f62\u5f0f\u306b\u3082\u5bfe\u5fdc\u3059\u308b\u3002<br>Set objRE = CreateObject(\"VBScript.RegExp\")<br>objRE.IgnoreCase = True<br>objRE.Pattern = \"^R(\\d+)C(\\d+)$\"<br><strong><span class=\"has-inline-color has-vivid-red-color\">Set matches1 = objRE.Execute(cellAddress1)<br>Set matches2 = objRE.Execute(cellAddress2)<\/span><\/strong><\/p>\n\n\n\n<p><span class=\"has-inline-color has-vivid-red-color\">If <strong>matches1<\/strong>.Count = 0 Then<br><strong>Set cell1 = worksheet.Range(cellAddress1)<\/strong><br>Else<br>Set <strong>cell1<\/strong> = worksheet.Cells(matches(0).SubMatches(0) + 0, matches(0).SubMatches(1) + 0)<br>End If<\/span><\/p>\n\n\n\n<p><strong><span class=\"has-inline-color has-vivid-red-color\">If matches2.Count = 0 Then<\/span><\/strong><br><strong><span class=\"has-inline-color has-vivid-red-color\">Set cell2 = worksheet.Range(cellAddress2)<br>Else<br>Set cell2 = worksheet.Cells(matches(0).SubMatches(0) + 0, matches(0).SubMatches(1) + 0)<br>End If<\/span><\/strong><\/p>\n\n\n\n<p>On Error Goto 0<\/p>\n\n\n\n<p><span class=\"has-inline-color has-vivid-red-color\"><strong>If cell1 Is Nothing Then<br>Err.Raise 1, \"\", \"\u30bd\u30fc\u30c8\u30ad\u30fc1\u306e\u30bb\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002\"<br>End If<\/strong><\/span><\/p>\n\n\n\n<p><span class=\"has-inline-color has-vivid-red-color\"><strong>If cell2 Is Nothing Then<\/strong><br><strong>Err.Raise 1, \"\", \"\u30bd\u30fc\u30c8\u30ad\u30fc2\u306e\u30bb\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093\u3002\"<br>End If<\/strong><\/span><\/p>\n\n\n\n<p>If UCase(scell) = UCase(ecell) Then<br>Err.Raise 1, \"\", \"\u958b\u59cb\u30bb\u30eb\u3068\u7d42\u4e86\u30bb\u30eb\u3067\u540c\u3058\u30bb\u30eb\u306f\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002\"<br>WScript.Quit()<br>End If<\/p>\n\n\n\n<p>targetRange = scell&amp;\":\"&amp;ecell<\/p>\n\n\n\n<p>'cell.select<\/p>\n\n\n\n<p>If header = \"\" Then<br><strong><span class=\"has-inline-color has-vivid-red-color\">worksheet.range(targetRange).Sort cell2,order2'\u203b\u9006\u8ee2\u3055\u305b\u308b<br>worksheet.range(targetRange).Sort cell1,order1'\u203b\u9006\u8ee2\u3055\u305b\u308b<\/span><\/strong><br>Else<br><strong><span class=\"has-inline-color has-vivid-red-color\">worksheet.range(targetRange).Sort cell2,order2,,,,,,header'\u203b\u9006\u8ee2\u3055\u305b\u308b<br>worksheet.range(targetRange).Sort cell1,order1,,,,,,header'\u203b\u9006\u8ee2\u3055\u305b\u308b<\/span><\/strong><br>End If<\/p>\n\n\n\n<p>Set objRE = Nothing<br>Set xlsApp = Nothing<br>Set worksheet = Nothing<br>Set workbook = Nothing<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u8a2d\u5b9a\u5185\u5bb9\u306f\u3053\u3093\u306a\u611f\u3058<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"626\" height=\"566\" src=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-110.png\" alt=\"\" class=\"wp-image-5290\" srcset=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-110.png 626w, https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-110-300x271.png 300w\" sizes=\"auto, (max-width: 626px) 100vw, 626px\" \/><\/figure>\n\n\n\n<p>\u51fa\u8377\u6570\u306e\u6607\u9806<br>\u5546\u54c1\u30b3\u30fc\u30c9\u306e\u964d\u9806<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u25b6\u3067\u5b9f\u884c\u3057\u3066\u307f\u308b<\/h2>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"724\" height=\"600\" src=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-111.png\" alt=\"\" class=\"wp-image-5292\" srcset=\"https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-111.png 724w, https:\/\/lacotasu.com\/wp-content\/uploads\/2021\/12\/image-111-300x249.png 300w\" sizes=\"auto, (max-width: 724px) 100vw, 724px\" \/><\/figure>\n\n\n\n<p>\u51fa\u8377\u6570\u306e\u6607\u9806<br>\u5546\u54c1\u30b3\u30fc\u30c9\u306e\u964d\u9806 <br>\u3067\u30bd\u30fc\u30c8\u3055\u308c\u307e\u3057\u305f\uff01<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4ee5\u4e0a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u63d0\u6761\u4ef6\u3068\u76ee\u6a19 \u2193 \u3053\u3046\u3044\u3046Excel\u304c\u3042\u3063\u305f\u3068\u3059\u308b\u3002 \u8907\u6570\u306e\u5217\u3067\u4e26\u3073\u66ff\u3048\u305f\u3044\u3002 \u6700\u521d\u304b\u3089\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3053\u306e\u30ce\u30fc\u30c9\u3092\u3061\u3087\u3053\u3063\u3068\u4fee\u6b63\u3057\u305f \u3053\u306e\u307e\u307e\u3060\u3068\u4e00\u3064\u306e\u9805\u76ee\u3067\u3057\u304b\u4e26\u3073\u66ff\u3048\u3067\u304d\u306a\u3044\u3002\u8907\u6570\u306e\u5217\u3067\u4e26\u3073\u66ff\u3048 ... <\/p>\n","protected":false},"author":1,"featured_media":5288,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[61,109],"tags":[],"class_list":["post-5277","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-rpa","category-winactor"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/lacotasu.com\/index.php?rest_route=\/wp\/v2\/posts\/5277","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lacotasu.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lacotasu.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lacotasu.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lacotasu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5277"}],"version-history":[{"count":6,"href":"https:\/\/lacotasu.com\/index.php?rest_route=\/wp\/v2\/posts\/5277\/revisions"}],"predecessor-version":[{"id":5294,"href":"https:\/\/lacotasu.com\/index.php?rest_route=\/wp\/v2\/posts\/5277\/revisions\/5294"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lacotasu.com\/index.php?rest_route=\/wp\/v2\/media\/5288"}],"wp:attachment":[{"href":"https:\/\/lacotasu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5277"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lacotasu.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5277"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lacotasu.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5277"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}