{"id":673,"date":"2019-02-24T22:39:09","date_gmt":"2019-02-24T13:39:09","guid":{"rendered":"https:\/\/ito-u-oti.com\/?p=673"},"modified":"2019-02-24T22:39:09","modified_gmt":"2019-02-24T13:39:09","slug":"post-673","status":"publish","type":"post","link":"https:\/\/ito-u-oti.com\/?p=673","title":{"rendered":"\u5171\u6709\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4e0a\u306b\u3042\u308bExccel\u30de\u30af\u30ed\u3092\u5b9a\u6642\u5b9f\u884c\u3055\u305b\u308b"},"content":{"rendered":"<h2 id=\"outline__1\">\u80cc\u666f<\/h2>\n<p>\u81ea\u5206\u306e\u62c5\u5f53\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3067\u3082\u9032\u6357\u7ba1\u7406\u306f\u7d76\u8cdbExcel\u306b\u3088\u308b\u7ba1\u7406\u3060\u3002<br \/>\n\u305d\u3057\u3066\u3001Excel\u3092\u958b\u3044\u3066\u7d44\u307f\u8fbc\u3093\u3067\u3042\u308b\u30de\u30af\u30ed\u3092\u5f53\u3066\u3053\u3093\u3060\u30dc\u30bf\u30f3\u3092\u30dd\u30c1\u3063\u3068\u62bc\u3057\u3066\u9032\u6357\u72b6\u6cc1\u306e\u6700\u65b0\u5316\u3092\u884c\u3063\u3066\u3044\u308b\u3002\uff08\u6bce\u65e5\uff01\uff09<\/p>\n<p>\u305d\u3057\u3066\u305d\u308c\u306f\u3068\u3066\u3064\u3082\u306a\u304f\u9762\u5012\u306a\u306e\u3067\u3001Jenkins\u306b\u3088\u308b\u5b9a\u671f\u5b9f\u884c\u3067\u81ea\u52d5\u3067\u9032\u6357\u66f4\u65b0\u3055\u305b\u308b\u3053\u3068\u306b\u3057\u305f\u3053\u3068\u304c\u59cb\u307e\u308a\u3002<\/p>\n<h2 id=\"outline__2\">\u8a2d\u8a08<\/h2>\n<p>\uff11\uff0ejenkins\u304c\u4e00\u5b9a\u306e\u6642\u9593\u306b\u306a\u308b\u3068\u30ed\u30fc\u30ab\u30eb\u306b\u3042\u308bbat\u30d5\u30a1\u30a4\u30eb\u3092\u8d77\u52d5\u3059\u308b<br \/>\n\uff12\uff0ebat\u30d5\u30a1\u30a4\u30eb\u306f\u5171\u6709\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4e0a\u306b\u3042\u308bvbs\u30d5\u30a1\u30a4\u30eb\u3092\u8d77\u52d5\u3059\u308b<br \/>\n\uff13\uff0evbs\u30d5\u30a1\u30a4\u30eb\u306fExcel\u306e\u30de\u30af\u30ed\u3092\u8d77\u52d5\u3059\u308b<br \/>\n<img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/02\/excel_jenkins.png\" alt=\"\" width=\"842\" height=\"595\" class=\"alignnone size-full wp-image-703\" \/><\/p>\n<p>\u306a\u3093\u3068\u3082\u56de\u308a\u304f\u3069\u3044\u65b9\u6cd5\u3060\u3068\u601d\u3046\u3002<br \/>\n\u30de\u30af\u30ed\u3092\u52d5\u304b\u3059\u305f\u3081\u306b\u30d0\u30c3\u30c1\u30d5\u30a1\u30a4\u30eb\u3092\u4e8c\u3064\u3082\u4f5c\u3089\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3068\u306f\u30fb\u30fb\u30fb<\/p>\n<h2 id=\"outline__3\">\u69cb\u7bc9<\/h2>\n<h3 id=\"outline__3_1\">JenkinsExec_excel.bat<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n@echo off\r\nsetlocal enabledelayedexpansion\r\ncd %~dp0\r\n\r\nset CONNECT_IP=\\\\XXX.XXX.X.XX\r\nset CONNECT_USER=\\username\r\nset CONNECT_PASS=password\r\n\r\nset EXEDIR=&quot;\\\\XXX.XXX.X.XX\\share&quot;\r\nset comment=&quot;\u79c1\u304cJenkins\u304a\u3058\u3055\u3093\u3067\u3042\u308b&quot;\r\n\r\nset MACROMAIN=main_batch\r\n\r\nset TARGETXLSM=sharedExcel.xlsm\r\n\r\nnet use %CONNECT_IP% %CONNECT_PASS% \/user:%CONNECT_USER% &gt;nul 2&lt;&amp;1\r\n\r\npushd %EXEDIR%\r\n\r\nsharedExcel.vbs %EXEDIR%\\%TARGETXLSM% %MACROMAIN%\r\n\r\npopd\r\n\r\nexit 0\r\n<\/pre>\n<p>\u4e3b\u306a\u4ed5\u4e8b\u306f\u5171\u6709\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3078\u306e\u63a5\u7d9a\u4f5c\u696d\u3002<br \/>\n\u3055\u3089\u306bcomment\u3068\u3044\u3046\u74b0\u5883\u5909\u6570\u3092\u8a2d\u5b9a\u3057\u3001\u5f8c\u306bExcel\u30de\u30af\u30ed\u4e0a\u3067\u53d6\u5f97\u3057\u3066\u5024\u3092\u30bb\u30eb\u306b\u8a2d\u5b9a\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u308b\u3002<br \/>\n\u305d\u306e\u5f8c\u3001\u63a5\u7d9a\u3057\u305f\u5171\u6709\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4e0a\u306b\u3042\u308bvbs\u30d5\u30a1\u30a4\u30eb\u3092\u53e9\u3044\u3066\u3044\u308b\u3002<\/p>\n<h3 id=\"outline__3_2\">sharedExcel.vbs<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n'argument: &lt;ExcelFile&gt; &lt;MacroName&gt;\r\n'ex: &quot;c:\\xxx\\yyy\\zzz.xlsm&quot; Macro1\r\n\r\nDim obj\r\nSet obj=WScript.CreateObject(&quot;Excel.Application&quot;)\r\n\r\nobj.Visible=False\r\nobj.Workbooks.Open WScript.Arguments(0)\r\nobj.Application.Run WScript.Arguments(1)\r\n<\/pre>\n<p>\u3053\u3053\u3067bat\u30d5\u30a1\u30a4\u30eb\u304b\u3089\u53d7\u3051\u53d6\u3063\u305f\u5f15\u6570\u3092\u5143\u306b\u3057\u3066\u8d77\u52d5\u5bfe\u8c61\u306e\u30de\u30af\u30ed\u304c\u3042\u308bExcel\u3092\u8d77\u52d5\u3055\u305b\u3066\u3044\u308b\u3002<\/p>\n<h3 id=\"outline__3_3\">sharedExcel.xlsm<\/h3>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nOption Explicit\r\n\r\n'\u30d0\u30c3\u30c1\u8d77\u52d5\u7528\u30de\u30af\u30ed\r\nSub main_batch()\r\n\r\n    'STEP0 \u5f15\u6570\u53d6\u5f97\r\n    Dim args As String\r\n    args = Environ(&quot;comment&quot;)\r\n    \r\n    '\u30d0\u30c3\u30c1\u306b\u3088\u3063\u3066\u5b9f\u884c\u3057\u305f\u6642\u523b\u3092\u30b7\u30fc\u30c8\u306b\u8ffd\u8a18\u3059\u308b\u30de\u30af\u30ed\u3092\u8d77\u52d5\r\n    Call addData_batch(args)\r\n    \r\n    \r\n    ThisWorkbook.Save\r\n    Application.Quit\r\n\r\nEnd Sub\r\n\r\n\r\n'\u30d0\u30c3\u30c1\u306b\u3088\u3063\u3066\u5b9f\u884c\u3057\u305f\u6642\u523b\u3092\u30b7\u30fc\u30c8\u306b\u8ffd\u8a18\u3059\u308b\r\n\r\nSub addData_batch(args As String)\r\n\r\n    Application.DisplayAlerts = False\r\n    Application.ScreenUpdating = False\r\n    Dim row As Integer\r\n    Dim outputSheet As String\r\n    \r\n    '\u30b7\u30fc\u30c8\u6307\u5b9a\r\n    outputSheet = &quot;Sheet&quot;\r\n        \r\n    '\u51fa\u529b\u884c\r\n    row = Worksheets(outputSheet).Cells(Rows.count, &quot;A&quot;).End(xlUp).row + 1\r\n    '\u8d77\u52d5\u6642\u523b\u3092\u51fa\u529b\r\n    Worksheets(outputSheet).Range(&quot;A&quot; &amp; row).Value = Now\r\n    \r\n    '\u300c\u306f\u3044\u300d\u3092\u51fa\u529b\r\n    Worksheets(outputSheet).Range(&quot;B&quot; &amp; row).Value = &quot;\u306f\u3044&quot;\r\n    \r\n    '\u5f15\u6570\u3092\u51fa\u529b\r\n    Worksheets(outputSheet).Range(&quot;C&quot; &amp; row).Value = args\r\n\r\n\r\nEnd Sub\r\n\r\n'\u30de\u30af\u30ed\u3092\u5b9f\u884c\u3057\u305f\u6642\u523b\u3092\u30b7\u30fc\u30c8\u306b\u8ffd\u8a18\u3059\u308b\r\n\r\nSub addData()\r\n\r\n    Application.DisplayAlerts = False\r\n    Application.ScreenUpdating = False\r\n    Dim row As Integer\r\n    Dim outputSheet As String\r\n    \r\n    '\u30b7\u30fc\u30c8\u6307\u5b9a\r\n    outputSheet = &quot;Sheet&quot;\r\n        \r\n    '\u51fa\u529b\u884c\r\n    row = Worksheets(outputSheet).Cells(Rows.count, &quot;A&quot;).End(xlUp).row + 1\r\n    '\u8d77\u52d5\u6642\u523b\u3092\u51fa\u529b\r\n    Worksheets(outputSheet).Range(&quot;A&quot; &amp; row).Value = Now\r\n    \r\n    '\u300c\u3044\u3044\u3048\u300d\u3092\u51fa\u529b\r\n    Worksheets(outputSheet).Range(&quot;B&quot; &amp; row).Value = &quot;\u3044\u3044\u3048&quot;\r\n\r\nEnd Sub\r\n<\/pre>\n<p>Jenkins\u304b\u3089\u30de\u30af\u30ed\u3092\u8d77\u52d5<br \/>\nExcel\u3092\u8d77\u52d5\u3057\u3066\u30de\u30af\u30ed\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u30dc\u30bf\u30f3\u3092\u62bc\u4e0b<br \/>\n\u3053\u306e2\u30d1\u30bf\u30fc\u30f3\u306e\u30de\u30af\u30ed\u3092\u7d44\u3093\u3067\u307f\u305f\u3002<br \/>\n\u624b\u8d77\u52d5\u306f\u300c\u3044\u3044\u3048\u300d\u3068\u8ffd\u8a18\u3055\u308c\u3001Jenkins\u8d77\u52d5\u306f\u300c\u306f\u3044\u300d\u3068\u8ffd\u8a18\u3055\u308c\u308b\u3002<br \/>\n\u307e\u305f\u3001comment\u306e\u5185\u5bb9\u3082\u8ffd\u8a18\u3055\u308c\u308b\u3002<\/p>\n<h3 id=\"outline__3_4\">Jenkins job<\/h3>\n<p>\u30ab\u30b9\u30bf\u30e0\u30ef\u30fc\u30af\u30b9\u30da\u30fc\u30b9\u3068\u3057\u3066bat\u30d5\u30a1\u30a4\u30eb\u306e\u3042\u308b\u5834\u6240\u3092\u6307\u5b9a\u3057\u3066call\u3057\u3066\u3044\u308b\u3060\u3051<br \/>\n<img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/02\/jenkins_excel1.png\" alt=\"\" width=\"940\" height=\"111\" class=\"alignnone size-full wp-image-705\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/02\/jenkins_excel2.png\" alt=\"\" width=\"935\" height=\"347\" class=\"alignnone size-large wp-image-706\" \/><\/p>\n<h2 id=\"outline__4\">\u7d50\u679c<\/h2>\n<p>\u66f4\u65b0\u3055\u308c\u305f\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/02\/Excelmacro.png\" alt=\"\" width=\"1019\" height=\"601\" class=\"alignnone size-full wp-image-704\" \/><\/p>\n<h2 id=\"outline__5\">\u554f\u984c<\/h2>\n<p>\u30fbJenkins\u306e\u3042\u308b\u30b5\u30fc\u30d0\u306bExcel\u304c\u5165\u3063\u3066\u306a\u3044\u3068\u3044\u3051\u306a\u3044<br \/>\n\uff08\u3068\u3044\u3046\u3053\u3068\u3067\u5fc5\u7136\u7684\u306bWindowsOS\u306b\u4e57\u3063\u304b\u3063\u3066\u3044\u308bJenkins\u3060\u3051\u304c\u52d5\u4f5c\u3059\u308b\uff09<\/p>\n<p>\u30fb\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u306e\u8b66\u544a\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u304c\u51fa\u3066\u81ea\u52d5\u8d77\u52d5\u304c\u30a2\u30af\u30bb\u30b9\u62d2\u5426\u3055\u308c\u308b\u3002<br \/>\n<img decoding=\"async\" src=\"https:\/\/ito-u-oti.com\/wp-content\/uploads\/2019\/02\/\u30a8\u30af\u30bb\u30eb\u30de\u30af\u30ed\u8b66\u544a.png\" alt=\"\" width=\"467\" height=\"301\" class=\"alignnone size-full wp-image-707\" \/><br \/>\n\u3000\u2192\u30a4\u30f3\u30bf\u30fc\u30cd\u30c3\u30c8\u30aa\u30d7\u30b7\u30e7\u30f3\u2192\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u2192\u30ed\u30fc\u30ab\u30eb\u30a4\u30f3\u30c8\u30e9\u30cd\u30c3\u30c8\u2192\u30b5\u30a4\u30c8\u2192\u8a73\u7d30\u8a2d\u5b9a\u2192\u5171\u6709\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308bIP\u3092\u300c\u3053\u306eWeb\u30b5\u30a4\u30c8\u3092\u30be\u30fc\u30f3\u306b\u8ffd\u52a0\u3059\u308b\u300d\u306b\u5165\u529b\u3057\u3066\u8ffd\u52a0\u3092\u62bc\u3059<\/p>\n<h2 id=\"outline__6\">\u53c2\u8003<\/h2>\n<p><a href=\"https:\/\/qiita.com\/tomotagwork\/items\/4a5927142ee4b939c4cd\">Excel\u30de\u30af\u30ed\u3092\u30d0\u30c3\u30c1\u304b\u3089\u5b9f\u884c\u3059\u308b<\/a><br \/>\n<a href=\"https:\/\/color-variations.com\/server-error\">\u30d5\u30a1\u30a4\u30eb\u30b5\u30fc\u30d0\u30fc\u7b49\u306e\u5171\u6709\u30d5\u30a1\u30a4\u30eb\u5b9f\u884c\u6642\u306b\u51fa\u308b\u8b66\u544a\u3092\u975e\u8868\u793a\u306b\u3059\u308b\/Windows 10<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u80cc\u666f \u81ea\u5206\u306e\u62c5\u5f53\u3057\u3066\u3044\u308b\u3068\u3053\u308d\u3067\u3082\u9032\u6357\u7ba1\u7406\u306f\u7d76\u8cdbExcel\u306b\u3088\u308b\u7ba1\u7406\u3060\u3002 \u305d\u3057\u3066\u3001Excel\u3092\u958b\u3044\u3066 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":709,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[159],"tags":[162,161,163,160],"class_list":["post-673","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-jenkins","tag-jenkins","tag-vbs","tag-xlsx","tag-160"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=673"}],"version-history":[{"count":3,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/673\/revisions"}],"predecessor-version":[{"id":710,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/posts\/673\/revisions\/710"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=\/wp\/v2\/media\/709"}],"wp:attachment":[{"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ito-u-oti.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}