{"id":6697,"date":"2016-02-18T11:42:27","date_gmt":"2016-02-18T02:42:27","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=6697"},"modified":"2016-02-18T11:42:27","modified_gmt":"2016-02-18T02:42:27","slug":"microsoft-translator-api%e3%81%a7%e6%96%87%e5%ad%97%e5%88%97%e3%82%92%e7%bf%bb%e8%a8%b3%e3%81%99%e3%82%8bvba%e3%83%9e%e3%82%af%e3%83%ad","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=6697","title":{"rendered":"Microsoft Translator API\u3067\u6587\u5b57\u5217\u3092\u7ffb\u8a33\u3059\u308bVBA\u30de\u30af\u30ed"},"content":{"rendered":"<p>\u4ee5\u524d\u66f8\u3044\u305f<a href=\"\/\/www.ka-net.org\/blog\/?p=1274\" title=\"Google\u7ffb\u8a33\u3067\u6587\u5b57\u5217\u3092\u7ffb\u8a33\u3059\u308b\u30de\u30af\u30ed | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">\u8a18\u4e8b<\/a>\u3067\u3001Google\u7ffb\u8a33\u3092\u4f7f\u3063\u3066\u6587\u5b57\u5217\u3092\u7ffb\u8a33\u3059\u308b\u30de\u30af\u30ed\u3092\u7d39\u4ecb\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u4ed5\u69d8\u5909\u66f4\u304c\u3042\u3063\u305f\u3088\u3046\u3067\u3001\u3082\u3046\u3053\u306e\u30de\u30af\u30ed\u306f\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/cloud.google.com\/translate\/?hl=ja\" title=\"Translate API - \u7ffb\u8a33 API - Google Cloud Platform - Google Cloud Platform\" target=\"_blank\">\u6709\u511f\u306eTranslate API<\/a>\u306b\u5207\u308a\u66ff\u3048\u308c\u3070\u3001\u4f3c\u305f\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3067\u51e6\u7406\u3067\u304d\u308b\u3060\u308d\u3046\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u3053\u3053\u306fGoogle\u306b\u3053\u3060\u308f\u3089\u305a\u3001\u7121\u511f\u3067\u3042\u308b\u7a0b\u5ea6\u4f7f\u3048\u308b\u300c<a href=\"https:\/\/www.microsoft.com\/en-us\/translator\/translatorapi.aspx\" title=\"Translator API - Microsoft Translator\" target=\"_blank\">Microsoft Translator API<\/a>\u300d\u3092\u4f7f\u3063\u3066\u6587\u5b57\u5217\u3092\u7ffb\u8a33\u3059\u308bVBA\u30de\u30af\u30ed\u3092\u4f5c\u3063\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h4 class=\"style4a\">Azure Marketplace\u3067\u306e\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u767b\u9332<\/h4>\n<p>\u30de\u30af\u30ed\u304b\u3089API\u3092\u547c\u3073\u51fa\u3059\u306b\u3042\u305f\u308a\u3001\u307e\u305a\u306f<span style=\"color: #ff0000; font-weight: bold;\">Microsoft Azure Marketplace<\/span>\u3067\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u767b\u9332\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<ol>\n<li><a href=\"https:\/\/datamarket.azure.com\/home\/\" title=\"\u30db\u30fc\u30e0 | Microsoft Azure Marketplace\" target=\"_blank\">Microsoft Azure Marketplace<\/a>\u53f3\u4e0a\u306b\u3042\u308b\u300c\u30b5\u30a4\u30f3\u30a4\u30f3\u300d\u304b\u3089\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u500b\u4eba<\/span>\u300d\u3092\u9078\u629e\u3057\u3001Microsoft \u30a2\u30ab\u30a6\u30f3\u30c8\u3067\u30b5\u30a4\u30f3\u30a4\u30f3\u3057\u307e\u3059\u3002Microsoft \u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u6301\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u306f\u3001\u300c<a href=\"https:\/\/signup.live.com\/\" title=\"Microsoft \u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u65b0\u898f\u4f5c\u6210\" target=\"_blank\">Microsoft \u30a2\u30ab\u30a6\u30f3\u30c8\u306e\u65b0\u898f\u4f5c\u6210<\/a>\u300d\u304b\u3089\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u65b0\u898f\u767b\u9332\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_01.jpg\" alt=\"MicrosoftTranslatorAPI_VBA_01\" width=\"428\" height=\"207\" class=\"alignnone size-full wp-image-6698\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_01.jpg 428w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_01-300x145.jpg 300w\" sizes=\"auto, (max-width: 428px) 100vw, 428px\" \/><\/p>\n<li>Azure Marketplace\u306e\u767b\u9332\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u3001\u6c0f\u540d\u7b49\u306e\u5fc5\u8981\u4e8b\u9805\u3092\u5165\u529b\u3057\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u7d9a\u884c<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_02.jpg\" alt=\"MicrosoftTranslatorAPI_VBA_02\" width=\"997\" height=\"547\" class=\"alignnone size-full wp-image-6699\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_02.jpg 997w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_02-300x165.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_02-768x421.jpg 768w\" sizes=\"auto, (max-width: 997px) 100vw, 997px\" \/><\/p>\n<li>\u4f7f\u7528\u6761\u4ef6\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u3001\u5185\u5bb9\u3092\u78ba\u8a8d\u3057\u305f\u4e0a\u3067\u300c\u4f7f\u7528\u6761\u4ef6\u306b\u540c\u610f\u3057\u307e\u3059\u300d\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u767b\u9332<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_03.jpg\" alt=\"MicrosoftTranslatorAPI_VBA_03\" width=\"1001\" height=\"723\" class=\"alignnone size-full wp-image-6700\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_03.jpg 1001w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_03-300x217.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_03-768x555.jpg 768w\" sizes=\"auto, (max-width: 1001px) 100vw, 1001px\" \/><\/p>\n<li>Azure Marketplace\u3078\u306e\u767b\u9332\u304c\u7d42\u308f\u3063\u305f\u3089\u300c<a href=\"http:\/\/www.aka.ms\/TranslatorADM\" title=\"Microsoft Translator | Microsoft Azure Marketplace\" target=\"_blank\">Microsoft Translator<\/a>\u300d\u304b\u3089\u3001<span style=\"color: #ff0000; font-weight: bold;\">\u6708\u984d &yen;0<\/span>\u306e\u4e0b\u306b\u3042\u308b\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059(Microsoft Translator\u306f\u6708\u9593200\u4e07\u6587\u5b57\u307e\u3067\u7121\u511f\u3067\u5229\u7528\u3067\u304d\u307e\u3059)\u3002<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_04.jpg\" alt=\"MicrosoftTranslatorAPI_VBA_04\" width=\"975\" height=\"443\" class=\"alignnone size-full wp-image-6701\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_04.jpg 975w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_04-300x136.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_04-768x349.jpg 768w\" sizes=\"auto, (max-width: 975px) 100vw, 975px\" \/><\/p>\n<li>\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u3001\u516c\u958b\u5143\u306e\u30aa\u30d5\u30a1\u30fc\u3068\u30d7\u30e9\u30a4\u30d0\u30b7\u30fc \u30dd\u30ea\u30b7\u30fc\u3092\u78ba\u8a8d\u3057\u305f\u5f8c\u3001\u300c\u524d\u8ff0\u306e\u516c\u958b\u5143\u306e\u30aa\u30d5\u30a1\u30fc\u6761\u4ef6\u3068\u30d7\u30e9\u30a4\u30d0\u30b7\u30fc \u30dd\u30ea\u30b7\u30fc\u3092\u8aad\u307f\u3001\u5185\u5bb9\u306b\u540c\u610f\u3057\u307e\u3057\u305f\u3002\u300d\u306b\u30c1\u30a7\u30c3\u30af\u3092\u5165\u308c\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_05.jpg\" alt=\"MicrosoftTranslatorAPI_VBA_05\" width=\"998\" height=\"366\" class=\"alignnone size-full wp-image-6702\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_05.jpg 998w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_05-300x110.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_05-768x282.jpg 768w\" sizes=\"auto, (max-width: 998px) 100vw, 998px\" \/><\/p>\n<li>\u300c\u3042\u308a\u304c\u3068\u3046\u3054\u3056\u3044\u307e\u3059\u300d\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7\u5b8c\u4e86\u3067\u3059\u3002<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_06.jpg\" alt=\"MicrosoftTranslatorAPI_VBA_06\" width=\"743\" height=\"451\" class=\"alignnone size-full wp-image-6703\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_06.jpg 743w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_06-300x182.jpg 300w\" sizes=\"auto, (max-width: 743px) 100vw, 743px\" \/><\/p>\n<li>Microsoft Translator\u306e\u30b5\u30a4\u30f3\u30a2\u30c3\u30d7\u304c\u7d42\u308f\u3063\u305f\u3089\u3001<a href=\"https:\/\/datamarket.azure.com\/home\/\" title=\"\u30db\u30fc\u30e0 | Microsoft Azure Marketplace\" target=\"_blank\">Microsoft Azure Marketplace<\/a>\u306e\u53f3\u4e0b\u304b\u3089\u300c<a href=\"https:\/\/datamarket.azure.com\/developer\/applications\/register\" title=\"\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u767b\u9332\" target=\"_blank\">\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u767b\u9332<\/a>\u300d\u3092\u958b\u304d\u307e\u3059\u3002<\/li>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_07.jpg\" alt=\"MicrosoftTranslatorAPI_VBA_07\" width=\"631\" height=\"141\" class=\"alignnone size-full wp-image-6704\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_07.jpg 631w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_07-300x67.jpg 300w\" sizes=\"auto, (max-width: 631px) 100vw, 631px\" \/><\/p>\n<li>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306e\u767b\u9332\u753b\u9762\u304c\u8868\u793a\u3055\u308c\u305f\u3089\u3001\u5404\u9805\u76ee\u3092\u5165\u529b\u3057\u300c<span style=\"color: #ff0000; font-weight: bold;\">\u4f5c\u6210<\/span>\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/li>\n<ul>\n<li><span style=\"color: #ff0000; font-weight: bold;\">\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID<\/span>\uff1a\u5f8c\u8ff0\u306eAPI\u547c\u3073\u51fa\u3057\u306b\u5fc5\u8981\u306a\u3082\u306e\u3067\u3059\u3002\u5165\u529b\u5f8c\u306f\u30e1\u30e2\u5e33\u306a\u3069\u306b\u30b3\u30d4\u30fc\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/li>\n<li>\u540d\u524d\uff1a\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u540d\u3067\u3059\u3002<\/li>\n<li><span style=\"color: #ff0000; font-weight: bold;\">\u9867\u5ba2\u306e\u79d8\u5bc6(\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 \u30b7\u30fc\u30af\u30ec\u30c3\u30c8)<\/span>\uff1a\u5f8c\u8ff0\u306eAPI\u547c\u3073\u51fa\u3057\u306b\u5fc5\u8981\u306a\u3082\u306e\u3067\u3059\u3002\u901a\u5e38\u306f\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u8868\u793a\u3055\u308c\u3066\u3044\u308b\u6587\u5b57\u5217\u3067\u826f\u3044\u3067\u3057\u3087\u3046\u3002\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID\u3068\u540c\u3058\u304f\u3001\u30e1\u30e2\u5e33\u306a\u3069\u306b\u30b3\u30d4\u30fc\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/li>\n<li>\u30ea\u30c0\u30a4\u30ec\u30af\u30c8 URI\uff1a\u4eca\u56de\u306fVBA\u304b\u3089\u306e\u547c\u3073\u51fa\u3057\u3092\u884c\u3046\u4e88\u5b9a\u306a\u306e\u3067\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">https:\/\/localhost\/<\/span>\u300d\u306a\u3069\u306e\u9069\u5f53\u306aURI\u3067\u554f\u984c\u3042\u308a\u307e\u305b\u3093\u3002<\/li>\n<li>\u30b5\u30d6\u30c9\u30e1\u30a4\u30f3 \u30a2\u30af\u30bb\u30b9\u3092\u6709\u52b9\u306b\u3059\u308b\uff1a\u4eca\u56de\u306f\u30c1\u30a7\u30c3\u30af\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/li>\n<li>\u8aac\u660e\uff1a\u4eca\u56de\u306f\u7279\u306b\u5165\u529b\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_08.jpg\" alt=\"MicrosoftTranslatorAPI_VBA_08\" width=\"683\" height=\"553\" class=\"alignnone size-full wp-image-6705\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_08.jpg 683w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_08-300x243.jpg 300w\" sizes=\"auto, (max-width: 683px) 100vw, 683px\" \/>\n<\/ol>\n<p>\u4ee5\u4e0a\u3067\u6e96\u5099\u4f5c\u696d\u306f\u7d42\u4e86\u3067\u3059\u3002<\/p>\n<h4 class=\"style4a\">VBA\u304b\u3089\u306eMicrosoft Translator API\u547c\u3073\u51fa\u3057<\/h4>\n<p>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID\u3068\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 \u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u306e\u6e96\u5099\u304c\u3067\u304d\u305f\u3089\u3001\u3044\u3088\u3044\u3088\u30de\u30af\u30ed\u304b\u3089API\u3092\u547c\u3073\u51fa\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n<p>API\u3092\u5229\u7528\u3059\u308b\u624b\u9806\u306f\u30b6\u30c3\u30af\u30ea\u66f8\u304f\u3068\u4e0b\u8a18\u306e\u901a\u308a\u3067\u3059\u3002<\/p>\n<p>https:\/\/datamarket.accesscontrol.windows.net\/v2\/OAuth2-13 \u306b\u5fc5\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u4ed8\u3051\u3066POST\u3057\u307e\u3059(<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/hh454950.aspx\" title=\"Obtaining an Access Token\" target=\"_blank\">Obtaining an Access Token<\/a>\u53c2\u7167)\u3002<br \/>\n\u2193<br \/>\nJSON\u5f62\u5f0f\u3067\u8fd4\u3063\u3066\u304d\u305f\u30ec\u30b9\u30dd\u30f3\u30b9\u304b\u3089\u30a2\u30af\u30bb\u30b9 \u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<br \/>\n\u2193<br \/>\n\u5404API\u306e\u30ea\u30af\u30a8\u30b9\u30c8URI\u306b\u3001Authorization\u30d8\u30c3\u30c0\u30fc\u306b\u30a2\u30af\u30bb\u30b9 \u30c8\u30fc\u30af\u30f3\u3092\u4ed8\u3051\u3066\u3001\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u6295\u3052\u307e\u3059\u3002<br \/>\n\u2193<br \/>\n\u5e30\u3063\u3066\u304d\u305f\u30ec\u30b9\u30dd\u30f3\u30b9\u304b\u3089\u5fc5\u8981\u306a\u30c7\u30fc\u30bf\u3092\u53d6\u5f97\u30fb\u5229\u7528\u3057\u307e\u3059\u3002<\/p>\n<p>\u8a73\u7d30\u306b\u3064\u3044\u3066\u306f\u3001<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/dd576287.aspx\" title=\"Microsoft Translator\" target=\"_blank\">Microsoft Translator<\/a>\u3084<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/ff512419.aspx\" title=\"HTTP\" target=\"_blank\">\u5404\u30e1\u30bd\u30c3\u30c9\u306e\u8aac\u660e<\/a>\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u305d\u3057\u3066\u5b9f\u969b\u306b\u66f8\u3044\u305f\u30b3\u30fc\u30c9\u304c\u4e0b\u8a18\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b \u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID\u3068\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 \u30b7\u30fc\u30af\u30ec\u30c3\u30c8\u306f\u4e0a\u8a18\u624b\u9806\u3067\u53d6\u5f97\u3057\u305f\u3082\u306e\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/span><br \/>\n<span style=\"color: #ff0000; font-weight: bold;\">\u203b \u4e0b\u8a18\u30b3\u30fc\u30c9\u306fScriptControl\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u305f\u3081\u300164\u30d3\u30c3\u30c8\u7248\u306eOffice\u3067\u306f\u4f7f\u7528\u3067\u304d\u307e\u305b\u3093\u3002<\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub Sample()\r\n  Dim client_id As String\r\n  Dim client_secret As String\r\n  Dim source_str As String\r\n  \r\n  '********** \u8981\u5909\u66f4 **********\r\n  client_id = &quot;(\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 ID)&quot;\r\n  client_secret = &quot;(\u30af\u30e9\u30a4\u30a2\u30f3\u30c8 \u30b7\u30fc\u30af\u30ec\u30c3\u30c8)&quot;\r\n  source_str = &quot;\u3053\u3093\u3070\u3093\u306f\u3002\u6708\u304c\u7dba\u9e97\u3067\u3059\u306d\u3002&quot;\r\n  '****************************\r\n  \r\n  With CreateObject(&quot;WScript.Shell&quot;)\r\n    '\u65e5\u672c\u8a9e\u2192\u82f1\u8a9e\r\n    .Popup TranslateStringMS(client_id, _\r\n                             client_secret, _\r\n                             source_str)\r\n    '\u65e5\u672c\u8a9e\u2192\u4e2d\u56fd\u8a9e(\u7e41\u4f53\u5b57)\r\n    .Popup TranslateStringMS(client_id, _\r\n                             client_secret, _\r\n                             source_str, _\r\n                             &quot;ja&quot;, _\r\n                             &quot;zh-CHT&quot;)\r\n  End With\r\nEnd Sub\r\n\r\nPublic Function TranslateStringMS(ByVal client_id As String, _\r\n                                  ByVal client_secret As String, _\r\n                                  ByVal source_str As String, _\r\n                                  Optional ByVal from_lang As String = &quot;ja&quot;, _\r\n                                  Optional ByVal to_lang As String = &quot;en&quot;)\r\n'Microsoft Translator API\u3092\u4f7f\u3063\u3066\u6587\u5b57\u5217\u3092\u7ffb\u8a33\r\n'\u5229\u7528\u53ef\u80fd\u306a\u8a00\u8a9e\u30b3\u30fc\u30c9\u306f https:\/\/msdn.microsoft.com\/en-us\/library\/hh456380.aspx \u53c2\u7167\r\n'\u203b ScriptControl\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u305f\u3081\u300164\u30d3\u30c3\u30c8\u7248Office\u3067\u306f\u4f7f\u7528\u4e0d\u53ef\r\n  Dim url As String\r\n  Dim access_token As String\r\n  Dim ret As String\r\n  Dim d As Object\r\n  \r\n  ret = &quot;&quot;: Set d = Nothing '\u521d\u671f\u5316\r\n  access_token = GetAccessToken(client_id, client_secret)\r\n  url = &quot;http:\/\/api.microsofttranslator.com\/v2\/Http.svc\/Translate&quot; &amp; _\r\n        &quot;?text=&quot; &amp; EncodeURL(source_str) &amp; _\r\n        &quot;&amp;from=&quot; &amp; from_lang &amp; _\r\n        &quot;&amp;to=&quot; &amp; to_lang\r\n  On Error Resume Next\r\n  If Len(Trim(access_token)) &gt; 0 Then\r\n    With CreateObject(&quot;MSXML2.XMLHTTP&quot;)\r\n      .Open &quot;GET&quot;, url, False\r\n      .setRequestHeader &quot;Content-Type&quot;, &quot;application\/x-www-form-urlencoded;charset=utf-8&quot;\r\n      .setRequestHeader &quot;Authorization&quot;, &quot;Bearer &quot; &amp; access_token\r\n      .Send\r\n      Select Case .Status\r\n        Case 200: Set d = .responseXML\r\n      End Select\r\n    End With\r\n    If Not d Is Nothing Then ret = d.Text\r\n  End If\r\n  On Error GoTo 0\r\n  TranslateStringMS = ret\r\nEnd Function\r\n\r\nPrivate Function GetAccessToken(ByVal client_id As String, _\r\n                                ByVal client_secret As String, _\r\n                                Optional ByVal grant_type As String = &quot;client_credentials&quot;, _\r\n                                Optional ByVal scope As String = &quot;http:\/\/api.microsofttranslator.com&quot;) As String\r\n'\u30a2\u30af\u30bb\u30b9\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\r\n  Dim url As String\r\n  Dim js As String\r\n  Dim ret As String\r\n  Dim dat As Variant\r\n  Dim access_token '\u8868\u793a\u7528\u30c0\u30df\u30fc\r\n  \r\n  js = &quot;&quot;: ret = &quot;&quot; '\u521d\u671f\u5316\r\n  client_id = EncodeURL(client_id)\r\n  client_secret = EncodeURL(client_secret)\r\n  url = &quot;https:\/\/datamarket.accesscontrol.windows.net\/v2\/OAuth2-13&quot;\r\n  dat = &quot;grant_type=&quot; &amp; grant_type &amp; &quot;&amp;client_id=&quot; &amp; client_id &amp; _\r\n        &quot;&amp;client_secret=&quot; &amp; client_secret &amp; &quot;&amp;scope=&quot; &amp; scope\r\n  On Error Resume Next\r\n  With CreateObject(&quot;MSXML2.XMLHTTP&quot;)\r\n    .Open &quot;POST&quot;, url, False\r\n    .setRequestHeader &quot;Content-Type&quot;, &quot;application\/x-www-form-urlencoded;charset=utf-8&quot;\r\n    .Send dat\r\n    Select Case .Status\r\n      Case 200: js = .responseText\r\n    End Select\r\n  End With\r\n  If Len(Trim(js)) &gt; 0 Then\r\n    js = &quot;(&quot; &amp; js &amp; &quot;)&quot;\r\n    With CreateObject(&quot;ScriptControl&quot;)\r\n      .Language = &quot;JScript&quot;\r\n      ret = .CodeObject.eval(js).access_token\r\n    End With\r\n  End If\r\n  On Error GoTo 0\r\n  GetAccessToken = ret\r\nEnd Function\r\n\r\nPrivate Function EncodeURL(ByVal str As String) As String\r\n  With CreateObject(&quot;ScriptControl&quot;)\r\n    .Language = &quot;JScript&quot;\r\n    EncodeURL = .CodeObject.encodeURIComponent(str)\r\n  End With\r\nEnd Function<\/pre>\n<p>\u4e0a\u8a18\u300cSample\u300d\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u554f\u984c\u304c\u7121\u3051\u308c\u3070\u4e0b\u56f3\u306e\u3088\u3046\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u30dc\u30c3\u30af\u30b9\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_09.jpg\" alt=\"MicrosoftTranslatorAPI_VBA_09\" width=\"476\" height=\"178\" class=\"alignnone size-full wp-image-6706\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_09.jpg 476w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/MicrosoftTranslatorAPI_VBA_09-300x112.jpg 300w\" sizes=\"auto, (max-width: 476px) 100vw, 476px\" \/><\/p>\n<p>\u300cTranslateStringMS\u300d\u3067\u306f\u3001\u5f15\u6570\u300cfrom_lang\u300d\u3068\u300cto_lang\u300d\u3067\u7ffb\u8a33\u5143\u306e\u8a00\u8a9e\u3068\u7ffb\u8a33\u5148\u306e\u8a00\u8a9e\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002<br \/>\n\u3053\u3053\u3067\u5229\u7528\u53ef\u80fd\u306a\u8a00\u8a9e\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u306f\u3001\u300c<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/hh456380.aspx\" title=\"Translator Language Codes\" target=\"_blank\">Translator Language Codes<\/a>\u300d\u3092\u3054\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n<p>\u3068\u3044\u3046\u308f\u3051\u3067\u3001\u4eca\u56de\u306fVBA\u304b\u3089Microsoft Translator API\u3092\u547c\u3073\u51fa\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\n\u672c\u5f53\u306f\u6bce\u56de\u6bce\u56de\u30a2\u30af\u30bb\u30b9 \u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3059\u308b\u5fc5\u8981\u306f\u7121\u3044\u306e\u3067\u3059\u304c\u3001\u6709\u52b9\u671f\u9650\u304c\u5207\u308c\u305f\u3089\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3057\u306a\u304a\u3057\u3066\u30fb\u30fb\u30fb\u306a\u3093\u3066\u51e6\u7406\u306f\u3001\u9762\u5012\u304f\u3055\u3044\u306e\u3067\u4eca\u56de\u306f\u7701\u3044\u3066\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4ee5\u524d\u66f8\u3044\u305f\u8a18\u4e8b\u3067\u3001Google\u7ffb\u8a33\u3092\u4f7f\u3063\u3066\u6587\u5b57\u5217\u3092\u7ffb\u8a33\u3059\u308b\u30de\u30af\u30ed\u3092\u7d39\u4ecb\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u4ed5\u69d8\u5909\u66f4\u304c\u3042\u3063\u305f\u3088\u3046\u3067\u3001\u3082\u3046\u3053\u306e\u30de\u30af\u30ed\u306f\u4f7f\u7528\u3067\u304d\u306a\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002 \u6709\u511f\u306eTranslate API\u306b\u5207\u308a\u66ff\u3048\u308c\u3070\u3001\u4f3c\u305f\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3067\u51e6 [&hellip;]","protected":false},"author":1,"featured_media":7111,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[Microsoft Translator API\u3067\u6587\u5b57\u5217\u3092\u7ffb\u8a33\u3059\u308bVBA\u30de\u30af\u30ed]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,48,49,58],"tags":[],"class_list":["post-6697","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-word-office","category-powerpoint"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Excel.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1K1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6697","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6697"}],"version-history":[{"count":2,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6697\/revisions"}],"predecessor-version":[{"id":6708,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6697\/revisions\/6708"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7111"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6697"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6697"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6697"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}