{"id":5093,"date":"2014-12-04T17:41:48","date_gmt":"2014-12-04T08:41:48","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=5093"},"modified":"2014-12-04T17:41:48","modified_gmt":"2014-12-04T08:41:48","slug":"vbacommandbars%e2%97%8b%e2%97%8b-controls-add%e3%81%a7%e3%83%a1%e3%83%8b%e3%83%a5%e3%83%bc%e3%82%92%e8%bf%bd%e5%8a%a0%e3%81%a7%e3%81%8d%e3%81%aa%e3%81%8f%e3%81%aa%e3%81%a3%e3%81%9f%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=5093","title":{"rendered":"[VBA]CommandBars(&#8220;\u25cb\u25cb&#8221;).Controls.Add\u3067\u30e1\u30cb\u30e5\u30fc\u3092\u8ffd\u52a0\u3067\u304d\u306a\u304f\u306a\u3063\u305f\u3002"},"content":{"rendered":"<p>Office\u306e\u30e6\u30fc\u30b6\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u304c\u30ea\u30dc\u30f3\u306b\u5909\u308f\u3063\u3066\u304b\u3089\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u300c<span style=\"color: #ff0000; font-weight: bold;\">CommandBars(&#8220;\u25cb\u25cb&#8221;).Controls.Add\u3067\u30e1\u30cb\u30e5\u30fc\u3092\u8ffd\u52a0\u3067\u304d\u306a\u304f\u306a\u3063\u305f<\/span>\u300d\u3068\u3044\u3046\u8cea\u554f\u3092\u591a\u304f\u898b\u304b\u3051\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p><strong>\u30fb\u56f3\u5f62\u9078\u629e\u6642\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc<\/strong><br \/>\n<a href=\"http:\/\/www.moug.net\/faq\/viewtopic.php?t=70633\" title=\"Excel VBA \u3092\u5b66\u3076\u306a\u3089 moug \u30e2\u30fc\u30b0\uff5cExcel \uff08VBA\uff09\uff5c\u56f3\u5f62\u9078\u629e\u6642\u306e\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc\" target=\"_blank\">http:\/\/www.moug.net\/faq\/viewtopic.php?t=70633<\/a><br \/>\n<strong>\u30fbExcel2010\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306b\u3064\u3044\u3066<\/strong><br \/>\n<a href=\"http:\/\/answers.microsoft.com\/thread\/729b54cf-0fb2-4d79-9f20-520eb640254e\" title=\"Excel2010\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u306b\u3064\u3044\u3066 - \u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8 \u30b3\u30df\u30e5\u30cb\u30c6\u30a3\" target=\"_blank\">http:\/\/answers.microsoft.com\/thread\/729b54cf-0fb2-4d79-9f20-520eb640254e<\/a><br \/>\n<strong>\u30fbWith Application__ With .CommandBars(&#8220;Shapes&#8221;)__<\/strong><br \/>\n<a href=\"http:\/\/answers.microsoft.com\/thread\/f45d80ee-5a2d-40f0-8f38-6afa8d1bbf4d\" title=\"With Application__ With .CommandBars(\"Shapes\")__ - \u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8 \u30b3\u30df\u30e5\u30cb\u30c6\u30a3\" target=\"_blank\">http:\/\/answers.microsoft.com\/thread\/f45d80ee-5a2d-40f0-8f38-6afa8d1bbf4d<\/a><br \/>\n<strong>\u30fb\u633f\u5165\u3057\u305f\u56f3\u5f62\u4e0a\u3067\u53f3\u30af\u30ea\u30c3\u30af\u3057\u305f\u6642\u306e\u30e1\u30cb\u30e5\u30fc\u3092\u30de\u30af\u30ed\u3067\u975e\u8868\u793a\u3068\u3057\u305f\u3044\u3002<\/strong><br \/>\n<a href=\"http:\/\/answers.microsoft.com\/thread\/a351b326-457d-4a11-80fa-dbab078d531c\" title=\"\u633f\u5165\u3057\u305f\u56f3\u5f62\u4e0a\u3067\u53f3\u30af\u30ea\u30c3\u30af\u3057\u305f\u6642\u306e\u30e1\u30cb\u30e5\u30fc\u3092\u30de\u30af\u30ed\u3067\u975e\u8868\u793a\u3068\u3057\u305f\u3044\u3002 - \u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8 \u30b3\u30df\u30e5\u30cb\u30c6\u30a3\" target=\"_blank\">http:\/\/answers.microsoft.com\/thread\/a351b326-457d-4a11-80fa-dbab078d531c<\/a><\/p>\n<p>\u305f\u3057\u304b\u306bOffice 2003\u307e\u3067\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9\u3067\u53f3\u30af\u30ea\u30c3\u30af\u30e1\u30cb\u30e5\u30fc(\u30b3\u30f3\u30c6\u30ad\u30b9\u30c8\u30e1\u30cb\u30e5\u30fc)\u306b\u9805\u76ee\u3092\u8ffd\u52a0\u3059\u308b\u3053\u3068\u304c\u51fa\u6765\u305f\u306e\u3067\u3059\u304c\u3001<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub Sample()\r\n  With Application.CommandBars(&quot;Shapes&quot;) _\r\n                  .Controls.Add(Type:=msoControlPopup, Temporary:=True)\r\n    .Caption = &quot;My ContextMenu&quot;\r\n    With .Controls.Add(Type:=msoControlButton)\r\n      .Caption = &quot;My Menu&quot;\r\n      .FaceId = 59\r\n      .OnAction = &quot;btnMenu_OnAction&quot;\r\n    End With\r\n  End With\r\nEnd Sub\r\n\r\nPrivate Sub btnMenu_OnAction()\r\n  MsgBox &quot;\u3053\u3093\u306b\u3061\u306f\u3002&quot;, vbSystemModal + vbInformation\r\nEnd Sub<\/pre>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_01.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_01.jpg\" alt=\"CustomizeContextMenu_01\" width=\"575\" height=\"481\" class=\"alignnone size-full wp-image-5094\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_01.jpg 575w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_01-300x250.jpg 300w\" sizes=\"auto, (max-width: 575px) 100vw, 575px\" \/><\/a><\/p>\n<p>Office 2010\u3067\u540c\u3058\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3057\u3066\u3082\u4e0b\u56f3\u306e\u3088\u3046\u306b\u30e1\u30cb\u30e5\u30fc\u306f\u8ffd\u52a0\u3055\u308c\u307e\u305b\u3093\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_02.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_02.jpg\" alt=\"CustomizeContextMenu_02\" width=\"708\" height=\"458\" class=\"alignnone size-full wp-image-5095\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_02.jpg 708w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_02-300x194.jpg 300w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/a><\/p>\n<p>\u3067\u3059\u304c\u3001<span style=\"color: #ff0000; font-weight: bold;\">ShowPopup<\/span>\u30e1\u30bd\u30c3\u30c9\u3092\u5b9f\u884c\u3057\u3066\u307f\u308b\u3068\u3001\u3061\u3083\u3093\u3068\u30e1\u30cb\u30e5\u30fc\u304c\u8ffd\u52a0\u3055\u308c\u3066\u3044\u308b\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_03.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_03.jpg\" alt=\"CustomizeContextMenu_03\" width=\"664\" height=\"298\" class=\"alignnone size-full wp-image-5096\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_03.jpg 664w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_03-300x134.jpg 300w\" sizes=\"auto, (max-width: 664px) 100vw, 664px\" \/><\/a><\/p>\n<p>\u30e6\u30fc\u30b6\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u304c\u30b3\u30de\u30f3\u30c9\u30d0\u30fc\u304b\u3089\u30ea\u30dc\u30f3\u306b\u5909\u308f\u3063\u305f\u3053\u3068\u3067\u3001\u53f3\u30af\u30ea\u30c3\u30af\u30e1\u30cb\u30e5\u30fc\u306e\u4ed5\u69d8\u3082\u5909\u66f4\u3055\u308c\u305f\u3088\u3046\u3067\u3059\u3002<\/p>\n<p>\u3068\u3044\u3063\u3066\u3082\u3001\u53f3\u30af\u30ea\u30c3\u30af\u30e1\u30cb\u30e5\u30fc\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u65b9\u6cd5\u306f\u3061\u3083\u3093\u3068\u7528\u610f\u3055\u308c\u3066\u304a\u308a\u3001Office 2010\u4ee5\u964d\u3067\u306f\u4e0b\u8a18\u30da\u30fc\u30b8\u3067\u8aac\u660e\u3057\u3066\u3044\u308b\u3088\u3046\u306b\u3001\u30ea\u30dc\u30f3\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u3053\u3068\u306b\u3088\u3063\u3066\u3001\u53f3\u30af\u30ea\u30c3\u30af\u30e1\u30cb\u30e5\u30fc\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n(\u6b8b\u5ff5\u306a\u304c\u3089Office 2007\u3067\u306f\u540c\u3058\u65b9\u6cd5\u3067\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u3053\u3068\u306f\u3067\u304d\u307e\u305b\u3093\u3002)<\/p>\n<p><strong>\u30fb\u53f3\u30af\u30ea\u30c3\u30af\u30e1\u30cb\u30e5\u30fc\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b(Word 2010)<\/strong><br \/>\n<a href=\"\/\/www.ka-net.org\/ribbon\/ri36.html\" title=\"Office 2007\/2010\u30fb\u30ea\u30dc\u30f3\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">\/\/www.ka-net.org\/ribbon\/ri36.html<\/a><\/p>\n<p>\u305f\u3068\u3048\u3070\u3001\u4e0a\u8a18\u30b3\u30fc\u30c9\u306e\u3088\u3046\u306b\u56f3\u5f62\u9078\u629e\u6642\u306e\u53f3\u30af\u30ea\u30c3\u30af\u30e1\u30cb\u30e5\u30fc\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u5834\u5408\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30b3\u30fc\u30c9(\u4e0b\u8a18\u306fExcel\u5411\u3051)\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\u30fb\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\/2009\/07\/customui&quot;&gt;\r\n  &lt;contextMenus&gt;\r\n    &lt;contextMenu idMso=&quot;ContextMenuShape&quot;&gt;\r\n      &lt;menu id=&quot;mnuOrg&quot; label=&quot;My ContextMenu&quot;&gt;\r\n        &lt;button id=&quot;btnMenu&quot; label=&quot;My Menu&quot; imageMso=&quot;HappyFace&quot; onAction=&quot;btnMenu_onAction&quot; \/&gt;\r\n      &lt;\/menu&gt;\r\n    &lt;\/contextMenu&gt;\r\n  &lt;\/contextMenus&gt;\r\n&lt;\/customUI&gt;<\/pre>\n<p><strong>\u30fb\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb<\/strong><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">Option Explicit\r\n\r\nPublic Sub btnMenu_onAction(control As IRibbonControl)\r\n  MsgBox &quot;\u3053\u3093\u306b\u3061\u306f\u3002&quot;, vbSystemModal + vbInformation\r\nEnd Sub<\/pre>\n<p><a href=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_04.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_04.jpg\" alt=\"CustomizeContextMenu_04\" width=\"444\" height=\"464\" class=\"alignnone size-full wp-image-5097\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_04.jpg 444w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/CustomizeContextMenu_04-287x300.jpg 287w\" sizes=\"auto, (max-width: 444px) 100vw, 444px\" \/><\/a><\/p>\n<p>XML\u3092\u7de8\u96c6\u3057\u3066\u30ea\u30dc\u30f3\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b\u3001\u3068\u3044\u3046\u624b\u9593\u306f\u639b\u304b\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u304c\u3001\u3069\u3046\u3057\u3066\u3082\u53f3\u30af\u30ea\u30c3\u30af\u30e1\u30cb\u30e5\u30fc\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u305f\u3044\u3001\u3068\u3044\u3046\u5834\u5408\u306b\u306f\u4e00\u5ea6\u8a66\u3057\u3066\u307f\u3066\u306f\u3044\u304b\u304c\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Office\u306e\u30e6\u30fc\u30b6\u30a4\u30f3\u30bf\u30d5\u30a7\u30fc\u30b9\u304c\u30ea\u30dc\u30f3\u306b\u5909\u308f\u3063\u3066\u304b\u3089\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b\u300cCommandBars(&#8220;\u25cb\u25cb&#8221;).Controls.Add\u3067\u30e1\u30cb\u30e5\u30fc\u3092\u8ffd\u52a0\u3067\u304d\u306a\u304f\u306a\u3063\u305f\u300d\u3068\u3044\u3046\u8cea\u554f\u3092\u591a\u304f\u898b\u304b\u3051\u308b\u3088\u3046\u306b\u306a [&hellip;]","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":"\u6700\u8fd1\u8cea\u554f\u3092\u898b\u304b\u3051\u305f\u306e\u3067\u6539\u3081\u3066\u89e3\u8aac\u3002 [[VBA]CommandBars(\"\u25cb\u25cb\").Controls.Add\u3067\u30e1\u30cb\u30e5\u30fc\u3092\u8ffd\u52a0\u3067\u304d\u306a\u304f\u306a\u3063\u305f\u3002]","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,1],"tags":[],"class_list":["post-5093","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-ribbon"],"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-1k9","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5093","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=5093"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5093\/revisions"}],"predecessor-version":[{"id":5098,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5093\/revisions\/5098"}],"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=5093"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5093"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5093"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}