{"id":213,"date":"2017-10-06T08:08:02","date_gmt":"2017-10-05T23:08:02","guid":{"rendered":"https:\/\/jidouka.work\/?p=213"},"modified":"2017-10-06T08:10:05","modified_gmt":"2017-10-05T23:10:05","slug":"excel%e3%81%ae%e8%a1%a8%e3%81%ae%e5%86%85%e5%ae%b9%e3%81%8b%e3%82%89%e8%87%aa%e5%88%86%e5%a5%bd%e3%81%bf%e3%81%aehtml%e3%83%9a%e3%83%bc%e3%82%b8%e3%82%92%e7%94%9f%e6%88%90%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/jidouka.work\/?p=213","title":{"rendered":"Excel\u306e\u8868\u306e\u5185\u5bb9\u304b\u3089\u81ea\u5206\u597d\u307f\u306eHTML\u30da\u30fc\u30b8\u3092\u751f\u6210\u3059\u308b [VBA]"},"content":{"rendered":"<p>Excel\u81ea\u4f53\u306bWeb\u30da\u30fc\u30b8\u3068\u3057\u3066HTML\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3059\u308b\u6a5f\u80fd\u306f\u3064\u3044\u3066\u304a\u308a\u307e\u3059\u304c\u3001\u305f\u3060\u306e\u8868\u304c\u5165\u3063\u305fHTML\u3068\u3057\u3066\u306e\u4fdd\u5b58\u3068\u3044\u3046\u611f\u3058\u306e\u305f\u3081\u81ea\u7531\u5ea6\u304c\u4f4e\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\n\u4eca\u56de\u306fExcel\u306e\u30b7\u30fc\u30c8\u306e\u5185\u5bb9\u304b\u3089\u81ea\u5206\u306e\u4f5c\u308a\u305f\u3044\u30b9\u30bf\u30a4\u30eb\u306eWeb\u30da\u30fc\u30b8\u3092\u751f\u6210\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002\u3053\u306e\u65b9\u6cd5\u3092\u7528\u3044\u308c\u3070\u3001\u88fd\u54c1\u30b9\u30da\u30c3\u30af\u306e\u8868\u304b\u3089\u88fd\u54c1\u6bce\u306eWeb\u30da\u30fc\u30b8\u3092\u751f\u6210\u3059\u308b\u306a\u3093\u3066\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u624b\u52d5\u3067\u30da\u30fc\u30b8\u6bce\u306bHTML\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u5fc5\u8981\u304c\u306a\u304f\u306a\u308b\u305f\u3081\u3001Web\u30da\u30fc\u30b8\u4f5c\u6210\u306e\u52b9\u7387\u304c\u3088\u304f\u306a\u308a\u307e\u3059\u3002<br \/>\n\u57fa\u672c\u306f\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3078\u306e\u51fa\u529b\u3068\u540c\u69d8\u3067\u3059\u3002<\/p>\n<h2>\u30a8\u30af\u30bb\u30eb\u3067\u8868\u306e\u4f5c\u6210<\/h2>\n<p>\u307e\u305aHTML\u30da\u30fc\u30b8\u306b\u542b\u3081\u308b\u60c5\u5831\u306e\u8868\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u4eca\u56de\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u88fd\u54c1\u306e\u4ed5\u69d8\u8868\u304b\u3089\u30da\u30fc\u30b8\u3092\u751f\u6210\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/jidouka.work\/wp-content\/uploads\/2017\/10\/ac805384e12c6b6fb096f36b4fd5c2e5.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jidouka.work\/wp-content\/uploads\/2017\/10\/ac805384e12c6b6fb096f36b4fd5c2e5-300x252.jpg\" alt=\"\" width=\"300\" height=\"252\" class=\"alignnone size-medium wp-image-216\" srcset=\"https:\/\/jidouka.work\/wp-content\/uploads\/2017\/10\/ac805384e12c6b6fb096f36b4fd5c2e5-300x252.jpg 300w, https:\/\/jidouka.work\/wp-content\/uploads\/2017\/10\/ac805384e12c6b6fb096f36b4fd5c2e5.jpg 547w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<h2>\u751f\u6210\u3059\u308bHTML\u30da\u30fc\u30b8\u306e\u30c7\u30b6\u30a4\u30f3<\/h2>\n<p>HTML\u30da\u30fc\u30b8\u306e\u30c7\u30b6\u30a4\u30f3\u306f\u3053\u306e\u3088\u3046\u306b\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br \/>\n<a href=\"https:\/\/jidouka.work\/wp-content\/uploads\/2017\/10\/af1f1aa6bfd11575cb014b03667f3888.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/jidouka.work\/wp-content\/uploads\/2017\/10\/af1f1aa6bfd11575cb014b03667f3888-293x300.jpg\" alt=\"\" width=\"293\" height=\"300\" class=\"alignnone size-medium wp-image-217\" srcset=\"https:\/\/jidouka.work\/wp-content\/uploads\/2017\/10\/af1f1aa6bfd11575cb014b03667f3888-293x300.jpg 293w, https:\/\/jidouka.work\/wp-content\/uploads\/2017\/10\/af1f1aa6bfd11575cb014b03667f3888.jpg 710w\" sizes=\"auto, (max-width: 293px) 100vw, 293px\" \/><\/a><br \/>\n\u54c1\u540d\u3001\u578b\u756a\u306a\u3069\u305d\u308c\u305e\u308c\u3092\u88fd\u54c1\u306b\u5408\u308f\u305b\u3066\u5165\u308c\u3066\u3044\u304f\u5f62\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<figure class=\"jd-code\"><button type=\"button\" class=\"jd-code-copy\">\u30b3\u30d4\u30fc<\/button><pre><code class=\"language-javascript\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=&quot;ja&quot;&gt;\r\n&lt;head&gt;\r\n    &lt;meta charset=&quot;UTF-8&quot;&gt;\r\n    &lt;title&gt;\u54c1\u540d - \u578b\u756a\u306e\u4ed5\u69d8&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n    &lt;h1&gt;\u54c1\u540d - \u578b\u756a&lt;\/h1&gt;\r\n    &lt;h2&gt;\u6027\u80fd&lt;\/h2&gt;\r\n    \u3053\u306e\u88fd\u54c1\u306e\u6027\u80fd\u306f\u25cb\u25cb\u3067\u3059\u3002\r\n    &lt;h2&gt;\u5927\u304d\u3055&lt;\/h2&gt;\r\n    \u5e45:&lt;br&gt;\r\n    \u5965\u884c:&lt;br&gt;\r\n    \u9ad8\u3055:&lt;br&gt;\r\n    &lt;h2&gt;\u91cd\u91cf&lt;\/h2&gt;\r\n    \u25cb\u25cb kg\r\n    &lt;h2&gt;\u4fa1\u683c&lt;\/h2&gt;\r\n    \u25cb\u25cb\u5186\uff08\u7a0e\u8fbc\u4fa1\u683c\u25cb\u25cb\u5186\uff09\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/code><\/pre><\/figure>\n<h2>VBA\u306e\u30b3\u30fc\u30c9<\/h2>\n<figure class=\"jd-code\"><button type=\"button\" class=\"jd-code-copy\">\u30b3\u30d4\u30fc<\/button><pre><code class=\"language-vbnet\">Option Explicit\r\n\r\nSub generateProductSpecDescription()\r\n    Dim i As Integer\r\n    \r\n    Dim productName As String\r\n    Dim modelName As String\r\n    Dim spec As String\r\n    Dim width As Long\r\n    Dim depth As Long\r\n    Dim height As Long\r\n    Dim weight As Double\r\n    Dim price As Long\r\n    \r\n    &#039;\u88fd\u54c1\u306fB\u5217\u304b\u3089\u59cb\u307e\u308b\u305f\u3081i=2\r\n    i = 2\r\n    \r\n    &#039;\u88fd\u54c1\u540d\u304c\u5b58\u5728\u3059\u308b\u9650\u308a\u30eb\u30fc\u30d7\r\n    With Worksheets(&quot;Sheet1&quot;)\r\n    Do While .Cells(1, i).Value &lt;&gt; &quot;&quot;\r\n        productName = .Cells(1, i).Value\r\n        modelName = .Cells(2, i).Value\r\n        spec = .Cells(3, i).Value\r\n        width = .Cells(4, i).Value\r\n        depth = .Cells(5, i).Value\r\n        height = .Cells(6, i).Value\r\n        weight = .Cells(7, i).Value\r\n        price = .Cells(8, i).Value\r\n\r\n        \r\n    &#039;html\u30d5\u30a1\u30a4\u30eb\u3078\u66f8\u304d\u51fa\u3057\r\n        Dim htmlFile As String\r\n        \r\n        &#039;modelName\u3092\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u4f7f\u7528\u3001\u88fd\u54c1\u540d\u3092\u5c0f\u6587\u5b57\u306b\u5909\u63db\r\n        htmlFile = ActiveWorkbook.Path &amp; &quot;\\&quot; &amp; LCase(modelName) &amp; &quot;.html&quot;\r\n \r\n        Open htmlFile For Output As #1\r\n        \r\n        &#039;HTML\u306b\u51fa\u529b\r\n        Print #1, &quot;&lt;!DOCTYPE html&gt;&quot;\r\n        Print #1, &quot;&lt;html lang=&quot;&quot;; ja; &quot;&quot;&gt;&quot;\r\n        Print #1, &quot;&lt;meta charset=&quot;&quot;; UTF - 8; &quot;&quot;&gt;&quot;\r\n        Print #1, &quot;&lt;title&gt;&quot; &amp; productName &amp; &quot; - &quot; &amp; modelName &amp; &quot;&lt;\/title&gt;&quot;\r\n        Print #1, &quot;&lt;\/head&gt;&quot;\r\n        Print #1, &quot;&lt;body&gt;&quot;\r\n        Print #1, &quot;&lt;h1&gt;&quot; &amp; productName &amp; &quot; - &quot; &amp; modelName &amp; &quot;&lt;\/h1&gt;&quot;\r\n        Print #1, &quot;&lt;h2&gt;\u6027\u80fd&lt;\/h2&gt;&quot;\r\n        Print #1, &quot;\u3053\u306e\u88fd\u54c1\u306e\u6027\u80fd\u306f&quot; &amp; spec &amp; &quot;\u3067\u3059\u3002&quot;\r\n        Print #1, &quot;&lt;h2&gt;\u5927\u304d\u3055&lt;\/h2&gt;&quot;\r\n        Print #1, &quot;\u5e45:&quot; &amp; width &amp; &quot;&lt;br&gt;&quot;\r\n        Print #1, &quot;\u5965\u884c:&quot; &amp; depth &amp; &quot;&lt;br&gt;&quot;\r\n        Print #1, &quot;\u9ad8\u3055:&quot; &amp; height &amp; &quot;&lt;br&gt;&quot;\r\n        Print #1, &quot;&lt;h2&gt;\u91cd\u91cf&lt;\/h2&gt;&quot;\r\n        Print #1, weight &amp; &quot;kg&quot;\r\n        Print #1, &quot;&lt;h2&gt;\u4fa1\u683c&lt;\/h2&gt;&quot;\r\n        &#039;\u4fa1\u683c\u306b3\u6841\u533a\u5207\u308a\u306e,\u3092\u52a0\u3048\u308b\r\n        Print #1, Format(price, &quot;#,#&quot;) &amp; &quot;\u5186\uff08\u7a0e\u8fbc\u4fa1\u683c &quot; &amp; Format(price * 1.08, &quot;#,#&quot;) &amp; &quot;\u5186\uff09&quot;\r\n        Print #1, &quot;&lt;\/body&gt;&lt;\/html&gt;&quot;\r\n        \r\n        Close #1\r\n        \r\n        i = i + 1\r\n    Loop\r\n    End With\r\nEnd Sub\r\n<\/code><\/pre><\/figure>\n<h3>\u6587\u5b57\u5217\u3092\u5c0f\u6587\u5b57\u306b\u5909\u63db LCase<\/h3>\n<p>LCase(modelName)\u3067\u88fd\u54c1\u540d\u306e\u82f1\u6587\u5b57\u3092\u5c0f\u6587\u5b57\u306b\u5909\u63db\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u304c\u30d5\u30a1\u30a4\u30eb\u540d\u306b\u306a\u308a\u307e\u3059\u3002<br \/>\n\u9006\u306b\u5927\u6587\u5b57\u306b\u5909\u63db\u3059\u308b\u306b\u306fUCase(<em>str<\/em>)\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n<h3>&#8220;&#8221;\u306e\u4e2d\u3067&#8221;\u3092\u4f7f\u3046<\/h3>\n<p>&#8220;\u3092\u30a8\u30b9\u30b1\u30fc\u30d7\u3059\u308b\u305f\u3081\u306b\u306f&#8221;\u306e\u524d\u306b&#8221;\u3092\u3064\u3051\u307e\u3059\u3002<br \/>\n\u305d\u306e\u305f\u3081\u3000<strong>&#8220;&lt;html lang=&#8221;&#8221;; ja; &#8220;&#8221;&gt;&#8221;<\/strong>\u3000\u306e\u3088\u3046\u306a\u5f62\u306b\u306a\u3063\u3066\u307e\u3059\u3002<\/p>\n<h3>\u6570\u5b57\u306b\u6841\u533a\u5207\u308a\u306e\u30ab\u30f3\u30de\u3092\u5165\u308c\u308b Format<\/h3>\n<p>Format(price, &#8220;#,#&#8221;)\u3092\u4f7f\u3063\u3066\uff13\u6841\u76ee\u3068\uff14\u6841\u76ee\u306e\u9593\u306b\u30ab\u30f3\u30de\u3092\u5165\u308c\u3066\u3044\u307e\u3059\u3002<br \/>\n\u3053\u306eFormat\u95a2\u6570\u306f\u6841\u533a\u5207\u308a\u4ee5\u5916\u306b\u3082\u69d8\u3005\u306a\u66f8\u5f0f\u306e\u8868\u73fe\u306b\u4f7f\u3048\u307e\u3059\u3002<\/p>\n<p>Format \u95a2\u6570 (Visual Basic for Applications)<br \/>\n<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/office\/gg251755.aspx\">https:\/\/msdn.microsoft.com\/ja-jp\/library\/office\/gg251755.aspx<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Excel\u81ea\u4f53\u306bWeb\u30da\u30fc\u30b8\u3068\u3057\u3066HTML\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3059\u308b\u6a5f\u80fd\u306f\u3064\u3044\u3066\u304a\u308a\u307e\u3059\u304c\u3001\u305f\u3060\u306e\u8868\u304c\u5165\u3063\u305f &#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3],"tags":[],"class_list":["post-213","post","type-post","status-publish","format-standard","hentry","category-excel","category-vba"],"_links":{"self":[{"href":"https:\/\/jidouka.work\/index.php?rest_route=\/wp\/v2\/posts\/213","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jidouka.work\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jidouka.work\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jidouka.work\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jidouka.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=213"}],"version-history":[{"count":5,"href":"https:\/\/jidouka.work\/index.php?rest_route=\/wp\/v2\/posts\/213\/revisions"}],"predecessor-version":[{"id":223,"href":"https:\/\/jidouka.work\/index.php?rest_route=\/wp\/v2\/posts\/213\/revisions\/223"}],"wp:attachment":[{"href":"https:\/\/jidouka.work\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=213"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jidouka.work\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=213"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jidouka.work\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=213"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}