{"id":484,"date":"2025-01-25T02:33:38","date_gmt":"2025-01-24T17:33:38","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2025\/01\/%e3%80%8cexcel%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e3%82%af%e3%83%a9%e3%82%a6%e3%83%89%e9%80%a3%e6%90%ba%e3%83%9e%e3%82%af%e3%83%ad%e3%81%a7%e6%a5%ad%e5%8b%99%e5%8a%b9%e7%8e%87\/"},"modified":"2025-01-25T02:33:38","modified_gmt":"2025-01-24T17:33:38","slug":"%e3%80%8cexcel%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e3%82%af%e3%83%a9%e3%82%a6%e3%83%89%e9%80%a3%e6%90%ba%e3%83%9e%e3%82%af%e3%83%ad%e3%81%a7%e6%a5%ad%e5%8b%99%e5%8a%b9%e7%8e%87","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2025\/01\/%e3%80%8cexcel%e4%b8%8a%e7%b4%9a%e8%80%85%e5%bf%85%e8%a6%8b%ef%bc%81%e3%82%af%e3%83%a9%e3%82%a6%e3%83%89%e9%80%a3%e6%90%ba%e3%83%9e%e3%82%af%e3%83%ad%e3%81%a7%e6%a5%ad%e5%8b%99%e5%8a%b9%e7%8e%87\/","title":{"rendered":"\u300cExcel\u4e0a\u7d1a\u8005\u5fc5\u898b\uff01\u30af\u30e9\u30a6\u30c9\u9023\u643a\u30de\u30af\u30ed\u3067\u696d\u52d9\u52b9\u7387\u3092\u5287\u7684\u306b\u5411\u4e0a\u3055\u305b\u308b7\u3064\u306e\u79d8\u8a23\u300d"},"content":{"rendered":"<h2>Excel\u4e0a\u7d1a\u8005\u306e\u305f\u3081\u306e\u9ad8\u5ea6\u306a\u30af\u30e9\u30a6\u30c9\u9023\u643a\u30de\u30af\u30ed\u306e\u5b9f\u88c5<\/h2>\n<p>\u307e\u305a\u306f\u3001Excel\u3092\u4f7f\u3044\u3053\u306a\u3057\u3066\u3082\u3063\u3068\u697d\u3092\u3057\u305f\u3044\u3001\u696d\u52d9\u3092\u52b9\u7387\u5316\u3057\u305f\u3044\u4e0a\u7d1a\u8005\u306e\u65b9\u304c\u3059\u3050\u306b\u8a66\u305b\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n<p>&#8220;`vba<br \/>\nSub CloudSync()<br \/>\n    Dim ws As Worksheet<br \/>\n    Dim lastRow As Long<br \/>\n    Dim apiUrl As String<br \/>\n    Dim httpRequest As Object<\/p>\n<p>    Set ws = ThisWorkbook.Sheets(&#8220;\u30c7\u30fc\u30bf&#8221;)<br \/>\n    lastRow = ws.Cells(ws.Rows.Count, &#8220;A&#8221;).End(xlUp).Row<\/p>\n<p>    apiUrl = &#8220;https:\/\/api.example.com\/sync&#8221;<\/p>\n<p>    Set httpRequest = CreateObject(&#8220;MSXML2.XMLHTTP&#8221;)<\/p>\n<p>    With httpRequest<br \/>\n        .Open &#8220;POST&#8221;, apiUrl, False<br \/>\n        .setRequestHeader &#8220;Content-Type&#8221;, &#8220;application\/json&#8221;<\/p>\n<p>        Dim jsonData As String<br \/>\n        jsonData = &#8220;{&#8221;<br \/>\n        For i = 2 To lastRow<br \/>\n            jsonData = jsonData &#038; &#8220;&#8221;&#8221;&#8221; &#038; ws.Cells(i, 1).Value &#038; &#8220;&#8221;&#8221;:&#8221;&#8221;&#8221; &#038; ws.Cells(i, 2).Value &#038; &#8220;&#8221;&#8221;&#8221;<br \/>\n            If i < lastRow Then jsonData = jsonData &#038; \",\"\n        Next i\n        jsonData = jsonData &#038; \"}\"\n        \n        .send jsonData\n        \n        If .Status = 200 Then\n            MsgBox \"\u30c7\u30fc\u30bf\u304c\u6b63\u5e38\u306b\u540c\u671f\u3055\u308c\u307e\u3057\u305f\u3002\"\n        Else\n            MsgBox \"\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3057\u307e\u3057\u305f\u3002\u30b9\u30c6\u30fc\u30bf\u30b9\u30b3\u30fc\u30c9: \" &#038; .Status\n        End If\n    End With\nEnd Sub\n```\n\n\u3053\u306e\u30de\u30af\u30ed\u306f\u3001Excel\u30b7\u30fc\u30c8\u306e\u30c7\u30fc\u30bf\u3092\u30af\u30e9\u30a6\u30c9\u30b5\u30fc\u30d3\u30b9\u3068\u540c\u671f\u3055\u305b\u308b\u9ad8\u5ea6\u306a\u6a5f\u80fd\u3092\u63d0\u4f9b\u3057\u307e\u3059\u3002\u3067\u306f\u3001Excel \u30de\u30af\u30ed\u3092\u6d3b\u7528\u3057\u305f\u30af\u30e9\u30a6\u30c9\u9023\u643a\u306e\u5b9f\u88c5\u306b\u3064\u3044\u3066\u30013\u3064\u306e\u30dd\u30a4\u30f3\u30c8\u3067\u307e\u3068\u3081\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002\n\n\n\n<h3>1. API\u3068\u306e\u9023\u643a<\/h3>\n<p>Excel \u30de\u30af\u30ed\u3092\u4f7f\u3063\u3066\u30af\u30e9\u30a6\u30c9\u30b5\u30fc\u30d3\u30b9\u3068\u9023\u643a\u3059\u308b\u969b\u3001\u6700\u3082\u91cd\u8981\u306a\u306e\u306fAPI\u3068\u306e\u9023\u643a\u3067\u3059\u3002\u4e0a\u8a18\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001`MSXML2.XMLHTTP`\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u4f7f\u7528\u3057\u3066HTTP\u901a\u4fe1\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001Excel\u304b\u3089Web\u30b5\u30fc\u30d3\u30b9\u306eAPI\u306b\u30c7\u30fc\u30bf\u3092\u9001\u4fe1\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>API\u30a8\u30f3\u30c9\u30dd\u30a4\u30f3\u30c8\uff08\u3053\u306e\u4f8b\u3067\u306f`https:\/\/api.example.com\/sync`\uff09\u3092\u6b63\u3057\u304f\u8a2d\u5b9a\u3057\u3001\u9069\u5207\u306a\u30d8\u30c3\u30c0\u30fc\uff08\u3053\u306e\u5834\u5408\u306f`Content-Type: application\/json`\uff09\u3092\u6307\u5b9a\u3059\u308b\u3053\u3068\u304c\u91cd\u8981\u3067\u3059\u3002\u307e\u305f\u3001\u30a8\u30e9\u30fc\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3092\u5b9f\u88c5\u3057\u3001API\u547c\u3073\u51fa\u3057\u306e\u7d50\u679c\u3092\u78ba\u8a8d\u3059\u308b\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u540c\u671f\u306e\u4fe1\u983c\u6027\u3092\u9ad8\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>2. \u30c7\u30fc\u30bf\u306e\u69cb\u9020\u5316\u3068\u5909\u63db<\/h3>\n<p>\u30af\u30e9\u30a6\u30c9\u30b5\u30fc\u30d3\u30b9\u3068\u30c7\u30fc\u30bf\u3092\u3084\u308a\u53d6\u308a\u3059\u308b\u969b\u3001\u9069\u5207\u306a\u30c7\u30fc\u30bf\u5f62\u5f0f\u306b\u5909\u63db\u3059\u308b\u3053\u3068\u304c\u4e0d\u53ef\u6b20\u3067\u3059\u3002\u3053\u306e\u4f8b\u3067\u306f\u3001Excel\u30b7\u30fc\u30c8\u306e\u30c7\u30fc\u30bf\u3092JSON\u5f62\u5f0f\u306b\u5909\u63db\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>&#8220;`vba<br \/>\njsonData = &#8220;{&#8221;<br \/>\nFor i = 2 To lastRow<br \/>\n    jsonData = jsonData &#038; &#8220;&#8221;&#8221;&#8221; &#038; ws.Cells(i, 1).Value &#038; &#8220;&#8221;&#8221;:&#8221;&#8221;&#8221; &#038; ws.Cells(i, 2).Value &#038; &#8220;&#8221;&#8221;&#8221;<br \/>\n    If i < lastRow Then jsonData = jsonData &#038; \",\"\nNext i\njsonData = jsonData &#038; \"}\"\n```\n\n\u3053\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u5909\u63db\u30ed\u30b8\u30c3\u30af\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067\u3001Excel\u306e\u30c7\u30fc\u30bf\u69cb\u9020\u3092API\u304c\u671f\u5f85\u3059\u308b\u5f62\u5f0f\u306b\u9069\u5408\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3088\u308a\u8907\u96d1\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u306e\u5834\u5408\u306f\u3001\u5c02\u7528\u306eJSON\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3082\u691c\u8a0e\u3057\u307e\u3057\u3087\u3046\u3002\n\n\n\n<h3>3. \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u8003\u616e<\/h3>\n<p>\u30af\u30e9\u30a6\u30c9\u9023\u643a\u3092\u5b9f\u88c5\u3059\u308b\u969b\u306f\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306b\u3082\u6ce8\u610f\u3092\u6255\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u9762\u3067\u306f\u3001API\u30ad\u30fc\u3084\u8a8d\u8a3c\u30c8\u30fc\u30af\u30f3\u306e\u5b89\u5168\u306a\u7ba1\u7406\u304c\u91cd\u8981\u3067\u3059\u3002\u3053\u308c\u3089\u306e\u6a5f\u5bc6\u60c5\u5831\u3092\u30cf\u30fc\u30c9\u30b3\u30fc\u30c7\u30a3\u30f3\u30b0\u305b\u305a\u3001\u6697\u53f7\u5316\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u3084Windows\u306e\u8cc7\u683c\u60c5\u5831\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u306a\u3069\u3092\u5229\u7528\u3057\u3066\u4fdd\u7ba1\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n<p>\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u9762\u3067\u306f\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u3092\u540c\u671f\u3059\u308b\u5834\u5408\u3001\u30d0\u30c3\u30c1\u51e6\u7406\u3084\u30da\u30fc\u30b8\u30cd\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067\u3001API\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u8ca0\u8377\u3092\u5206\u6563\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u307e\u305f\u3001\u975e\u540c\u671f\u51e6\u7406\u3092\u5c0e\u5165\u3059\u308b\u3053\u3068\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\u306e\u5fdc\u7b54\u6027\u3092\u7dad\u6301\u3057\u306a\u304c\u3089\u3001\u30d0\u30c3\u30af\u30b0\u30e9\u30a6\u30f3\u30c9\u3067\u30c7\u30fc\u30bf\u540c\u671f\u3092\u884c\u3046\u3053\u3068\u3082\u53ef\u80fd\u3067\u3059\u3002<\/p>\n<p>Excel \u30de\u30af\u30ed\u3092\u6d3b\u7528\u3057\u305f\u30af\u30e9\u30a6\u30c9\u9023\u643a\u306f\u3001\u696d\u52d9\u30d7\u30ed\u30bb\u30b9\u306e\u81ea\u52d5\u5316\u3068\u52b9\u7387\u5316\u306b\u5927\u304d\u304f\u8ca2\u732e\u3057\u307e\u3059\u3002API\u3068\u306e\u9023\u643a\u3001\u30c7\u30fc\u30bf\u306e\u69cb\u9020\u5316\u3001\u305d\u3057\u3066\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u3068\u30d1\u30d5\u30a9\u30fc\u30de\u30f3\u30b9\u306e\u6700\u9069\u5316\u3092\u610f\u8b58\u3057\u306a\u304c\u3089\u5b9f\u88c5\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u5f37\u529b\u3067\u4fe1\u983c\u6027\u306e\u9ad8\u3044\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Excel\u4e0a\u7d1a\u8005\u306e\u305f\u3081\u306e\u9ad8\u5ea6\u306a\u30af\u30e9\u30a6\u30c9\u9023\u643a\u30de\u30af\u30ed\u306e\u5b9f\u88c5 \u307e\u305a\u306f\u3001Excel\u3092\u4f7f\u3044\u3053\u306a\u3057\u3066\u3082\u3063\u3068\u697d\u3092\u3057\u305f\u3044\u3001\u696d\u52d9\u3092\u52b9\u7387\u5316\u3057\u305f\u3044\u4e0a\u7d1a\u8005\u306e\u65b9\u304c\u3059\u3050\u306b\u8a66\u305b\u308b\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u3092\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002 #8220;`vba Sub Cloud<\/p>\n","protected":false},"author":2,"featured_media":483,"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":[5],"tags":[],"class_list":["post-484","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-advanced"],"_links":{"self":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/484","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/comments?post=484"}],"version-history":[{"count":0,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/484\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/483"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=484"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=484"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=484"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}