{"id":196,"date":"2011-08-20T00:13:41","date_gmt":"2011-08-19T15:13:41","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=196"},"modified":"2011-08-21T12:13:52","modified_gmt":"2011-08-21T03:13:52","slug":"%e5%a4%96%e9%83%a8%e3%81%aexml%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%92%e8%aa%ad%e3%81%bf%e8%be%bc%e3%81%bf%e3%80%81%e3%83%a6%e3%83%bc%e3%82%b6%e3%83%bc%e5%90%8d%e3%81%ab%e5%bf%9c%e3%81%98","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=196","title":{"rendered":"\u5916\u90e8\u306eXML\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u307f\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u306b\u5fdc\u3058\u3066menu\u5185\u5bb9\u3092\u5909\u66f4\u3059\u308b"},"content":{"rendered":"<p><span style=\"color: #ff0000;\">dynamicMenu<\/span>\u8981\u7d20\u306e<span style=\"color: #ff0000;\">getContent<\/span>\u5c5e\u6027\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5916\u90e8\u304b\u3089XML\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u306b\u5fdc\u3058\u3066menu\u5185\u5bb9\u3092\u5909\u66f4\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<br \/>\n<!--more--><\/p>\n<p><strong>[\u30ea\u30dc\u30f3XML]<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;\r\n&lt;customUI xmlns=&quot;http:\/\/schemas.microsoft.com\/office\/2006\/01\/customui&quot;&gt;\r\n  &lt;ribbon&gt;\r\n    &lt;tabs&gt;\r\n      &lt;tab id=&quot;tabSample&quot; label=&quot;Sample Tab&quot;&gt;\r\n        &lt;group id=&quot;grpSample&quot; label=&quot;Sample Group&quot;&gt;\r\n          &lt;dynamicMenu id=&quot;dmuSample&quot; label=&quot;Sample Menu&quot; size=&quot;large&quot; imageMso=&quot;HappyFace&quot; getContent=&quot;dmuSample_getContent&quot; \/&gt;\r\n        &lt;\/group&gt;\r\n      &lt;\/tab&gt;\r\n    &lt;\/tabs&gt;\r\n  &lt;\/ribbon&gt;\r\n&lt;\/customUI&gt;<\/pre>\n<p><strong>[\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb]<\/strong><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPrivate Sub dmuSample_getContent(control As IRibbonControl, ByRef returnedVal)\r\n  Dim MenuXML As String\r\n  Dim MenuFilePath As String\r\n  \r\n  '\u30e6\u30fc\u30b6\u30fc\u540d\u3067\u8aad\u307f\u8fbc\u3080XML\u30d5\u30a1\u30a4\u30eb\u5206\u5c90\r\n  Select Case VBA.Environ$(&quot;USERNAME&quot;)\r\n    Case &quot;Admin&quot;\r\n      MenuFilePath = ThisWorkbook.Path &amp; &quot;\\MenuXML01.xml&quot;\r\n    Case Else\r\n      MenuFilePath = ThisWorkbook.Path &amp; &quot;\\MenuXML02.xml&quot;\r\n  End Select\r\n  MenuXML = LoadMenuFile(MenuFilePath)\r\n  If Len(Trim$(MenuXML)) &lt; 1 Then Exit Sub\r\n  returnedVal = MenuXML\r\nEnd Sub\r\n\r\nPrivate Function LoadMenuFile(ByVal FilePath As String) As String\r\n  Dim ret As String\r\n  \r\n  ret = &quot;&quot; '\u521d\u671f\u5316\r\n  On Error Resume Next\r\n  With CreateObject(&quot;Msxml2.DOMDocument&quot;)\r\n    .async = False\r\n    If .Load(FilePath) Then ret = .XML\r\n  End With\r\n  On Error GoTo 0\r\n  LoadMenuFile = ret\r\nEnd Function<\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u8a2d\u5b9a\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3068\u540c\u3058\u5834\u6240\u306b\u3001\u4e0b\u8a182\u3064\u306eXML\u30d5\u30a1\u30a4\u30eb\u3092\u4fdd\u5b58\u3057\u307e\u3059\u3002<\/p>\n<p><strong>[MenuXML01.xml]<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;menu xmlns=&quot;http:\/\/schemas.microsoft.com\/office\/2006\/01\/customui&quot; itemSize=&quot;large&quot;&gt;\r\n  &lt;button id=&quot;btnSample1&quot; label=&quot;Sample Button1&quot; imageMso=&quot;HappyFace&quot; \/&gt;\r\n  &lt;button id=&quot;btnSample2&quot; label=&quot;Sample Button2&quot; imageMso=&quot;HappyFace&quot; \/&gt;\r\n  &lt;button id=&quot;btnSample3&quot; label=&quot;Sample Button3&quot; imageMso=&quot;HappyFace&quot; \/&gt;\r\n  &lt;menu id=&quot;mnuSample&quot; label=&quot;Sample Menu&quot; itemSize=&quot;large&quot; imageMso=&quot;FileOpen&quot;&gt;\r\n    &lt;button id=&quot;btnSample4&quot; label=&quot;Sample Button4&quot; imageMso=&quot;HappyFace&quot; \/&gt;\r\n    &lt;button id=&quot;btnSample5&quot; label=&quot;Sample Button5&quot; imageMso=&quot;HappyFace&quot; \/&gt;\r\n    &lt;button id=&quot;btnSample6&quot; label=&quot;Sample Button6&quot; imageMso=&quot;HappyFace&quot; \/&gt;\r\n  &lt;\/menu&gt;\r\n&lt;\/menu&gt;<\/pre>\n<p><strong>[MenuXML02.xml]<\/strong><\/p>\n<pre class=\"brush: xml; title: ; notranslate\" title=\"\">&lt;menu xmlns=&quot;http:\/\/schemas.microsoft.com\/office\/2006\/01\/customui&quot; itemSize=&quot;large&quot;&gt;\r\n  &lt;menu id=&quot;mnuSample&quot; label=&quot;Sample Menu&quot; itemSize=&quot;large&quot; imageMso=&quot;FileOpen&quot;&gt;\r\n    &lt;button id=&quot;btnSample1&quot; label=&quot;Sample Button1&quot; imageMso=&quot;SadFace&quot; \/&gt;\r\n    &lt;button id=&quot;btnSample2&quot; label=&quot;Sample Button2&quot; imageMso=&quot;SadFace&quot; \/&gt;\r\n    &lt;button id=&quot;btnSample3&quot; label=&quot;Sample Button3&quot; imageMso=&quot;SadFace&quot; \/&gt;\r\n  &lt;\/menu&gt;\r\n  &lt;button id=&quot;btnSample4&quot; label=&quot;Sample Button4&quot; imageMso=&quot;SadFace&quot; \/&gt;\r\n  &lt;button id=&quot;btnSample5&quot; label=&quot;Sample Button5&quot; imageMso=&quot;SadFace&quot; \/&gt;\r\n  &lt;button id=&quot;btnSample6&quot; label=&quot;Sample Button6&quot; imageMso=&quot;SadFace&quot; \/&gt;\r\n&lt;\/menu&gt;<\/pre>\n<p>XML\u30d5\u30a1\u30a4\u30eb\u4fdd\u5b58\u5f8c\u3001\u30ea\u30dc\u30f3\u30fb\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304f\u3068\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u304c\u300c<span style=\"color: #ff0000;\">Admin<\/span>\u300d\u306e\u5834\u5408\u306f<strong>MenuXML01.xml<\/strong>\u30d5\u30a1\u30a4\u30eb\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3001\u300c<strong>Sample Tab<\/strong>\u300d\u30bf\u30d6\u304c\u4e0b\u56f3\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML01.jpg\" alt=\"\" title=\"LoadXML01\" width=\"384\" height=\"404\" class=\"alignnone size-full wp-image-200\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML01.jpg 384w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML01-285x300.jpg 285w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML01-290x305.jpg 290w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML01-142x150.jpg 142w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/p>\n<p>\u30e6\u30fc\u30b6\u30fc\u540d\u304c\u300c<span style=\"color: #ff0000;\">Admin<\/span>\u300d\u4ee5\u5916\u306e\u5834\u5408\u306b\u306f\u3001<strong>MenuXML02.xml<\/strong>\u30d5\u30a1\u30a4\u30eb\u304c\u8aad\u307f\u8fbc\u307e\u308c\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306b\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML02.jpg\" alt=\"\" title=\"LoadXML02\" width=\"384\" height=\"404\" class=\"alignnone size-full wp-image-201\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML02.jpg 384w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML02-285x300.jpg 285w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML02-290x305.jpg 290w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/LoadXML02-142x150.jpg 142w\" sizes=\"auto, (max-width: 384px) 100vw, 384px\" \/><\/p>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306b\u3001<span style=\"color: #ff0000;\">dynamicMenu<\/span>\u8981\u7d20\u306e<span style=\"color: #ff0000;\">getContent<\/span>\u5c5e\u6027\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5916\u90e8\u306eXML\u30d5\u30a1\u30a4\u30eb\u306b\u5fdc\u3058\u3066\u30ea\u30dc\u30f3(\u306e\u4e00\u90e8)\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"dynamicMenu\u8981\u7d20\u306egetContent\u5c5e\u6027\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5916\u90e8\u304b\u3089XML\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3093\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u540d\u306b\u5fdc\u3058\u3066menu\u5185\u5bb9\u3092\u5909\u66f4\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002","protected":false},"author":1,"featured_media":7130,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1],"tags":[12,7,11],"class_list":["post-196","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ribbon","tag-12","tag-ribbon-2","tag-office-2"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Ribbon.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-3a","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/196","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=196"}],"version-history":[{"count":10,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/196\/revisions"}],"predecessor-version":[{"id":219,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/196\/revisions\/219"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7130"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}