{"id":6596,"date":"2016-01-29T10:50:09","date_gmt":"2016-01-29T01:50:09","guid":{"rendered":"http:\/\/www.ka-net.org\/blog\/?p=6596"},"modified":"2016-01-29T10:50:09","modified_gmt":"2016-01-29T01:50:09","slug":"vba%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%82%bf%e3%83%96backstage-%e3%83%93%e3%83%a5%e3%83%bc%e3%81%ae%e8%a1%a8%e7%a4%ba%e3%82%92%e7%a6%81%e6%ad%a2%e3%81%99%e3%82%8b%e3%80%82","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=6596","title":{"rendered":"[VBA]\u30d5\u30a1\u30a4\u30eb\u30bf\u30d6(Backstage \u30d3\u30e5\u30fc)\u306e\u8868\u793a\u3092\u7981\u6b62\u3059\u308b\u3002"},"content":{"rendered":"<p>\u6570\u5e74\u524d<a href=\"\/\/www.ka-net.org\/\" title=\"Office 2007\/2010\u30fb\u30ea\u30dc\u30f3\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">\u30db\u30fc\u30e0\u30da\u30fc\u30b8<\/a>\u3067\u300c<a href=\"\/\/www.ka-net.org\/ribbon\/ri39.html\" title=\"\u30d5\u30a1\u30a4\u30eb\u30bf\u30d6\u30dc\u30bf\u30f3\u306e\u30af\u30ea\u30c3\u30af\u3092\u7981\u6b62\u3059\u308b(Office 2010)\" target=\"_blank\">\u30d5\u30a1\u30a4\u30eb\u30bf\u30d6\u30dc\u30bf\u30f3\u306e\u30af\u30ea\u30c3\u30af\u3092\u7981\u6b62\u3059\u308b(Office 2010)<\/a>\u300d\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u5148\u65e5Excel 2013\u74b0\u5883\u3067\u4f7f\u3048\u306a\u3044\u3001\u3068\u306e\u8cea\u554f\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u4f55\u305bOffice 2010 Public Beta\u7248\u306e\u9803\u306b\u66f8\u3044\u305f\u3082\u306e\u306a\u306e\u3067\u3001\u88fd\u54c1\u7248\u306eOffice 2010\u30842013\u30012016\u3067\u4f7f\u3048\u306a\u304f\u306a\u3063\u3066\u3044\u3066\u3082\u304a\u304b\u3057\u304f\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u4f7f\u3048\u306a\u3044\u539f\u56e0\u3092\u8abf\u3079\u3066\u3001\u30b3\u30fc\u30c9\u3092\u624b\u76f4\u3057\u3057\u3066\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u305b\u3063\u304b\u304f\u306a\u306e\u3067UI Automation\u3092\u4f7f\u3046\u5f62\u306b\u66f8\u304d\u63db\u3048\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<h4 class=\"style4a\">\u30ea\u30dc\u30f3XML<\/h4>\n<p>\u65b9\u6cd5\u3068\u3057\u3066\u306f\u3001\u4e0a\u8a18\u8a18\u4e8b\u3068\u540c\u69d8\u306bbackstage\u8981\u7d20\u306eonShow\u5c5e\u6027\u3092\u5229\u7528\u3057\u307e\u3059\u3002<\/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;backstage onShow=&quot;backstage_onShow&quot; \/&gt;\r\n&lt;\/customUI&gt;<\/pre>\n<h4 class=\"style4a\">\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb<\/h4>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b \u4e0b\u8a18\u30b3\u30fc\u30c9\u306fUIAutomationClient(UIAutomationCore.dll)\u8981\u53c2\u7167<\/span><\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">'\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb\r\n'UIAutomationClient(UIAutomationCore.dll)\u8981\u53c2\u7167\r\nOption Explicit\r\n\r\nPublic Sub backstage_onShow(contextObject As Object)\r\n  Dim cls As Class1\r\n  \r\n  Set cls = New Class1\r\n  MsgBox &quot;\u3010\u30d5\u30a1\u30a4\u30eb \u30bf\u30d6\u3011\u306e\u8868\u793a\u306f\u7981\u6b62\u3055\u308c\u3066\u3044\u307e\u3059\u3002&quot;, vbCritical + vbSystemModal\r\n  cls.SetTimeoutProc\r\nEnd Sub<\/pre>\n<h4 class=\"style4a\">\u30af\u30e9\u30b9\u30e2\u30b8\u30e5\u30fc\u30eb(Class1)<\/h4>\n<p>backstage\u8981\u7d20\u306eonShow\u5c5e\u6027\u306e\u30b3\u30fc\u30eb\u30d0\u30c3\u30af(backstage_onShow)\u304c\u5b9f\u884c\u3055\u308c\u308b\u30bf\u30a4\u30df\u30f3\u30b0\u3067\u306f\u3001\u307e\u3060Backstage \u30d3\u30e5\u30fc\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u306a\u3044\u305f\u3081\u3001Backstage \u30d3\u30e5\u30fc\u3092\u9589\u3058\u308b\u51e6\u7406\u3092\u6642\u9593\u5dee\u3067\u5b9f\u884c\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u306e\u3067\u3059\u304c\u3001\u3053\u3093\u306a\u3068\u304d\u306b\u4f7f\u3048\u308b<a href=\"https:\/\/msdn.microsoft.com\/ja-jp\/library\/ff196165.aspx\" title=\"Application.OnTime \u30e1\u30bd\u30c3\u30c9 (Excel)\" target=\"_blank\">Application.OnTime<\/a>\u30e1\u30bd\u30c3\u30c9\u306f\u3059\u3079\u3066\u306eOffice \u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u306b\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u308f\u3051\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>\u305d\u3053\u3067\u3001\u4e00\u624b\u9593\u639b\u304b\u3063\u3066\u3057\u307e\u3046\u306e\u3067\u3059\u304c\u3001\u300c<a href=\"\/\/www.ka-net.org\/office\/of12.html\" title=\"API\u3092\u4f7f\u308f\u306a\u3044\u30bf\u30a4\u30de\u30fc(Office VBA)\" target=\"_blank\">API\u3092\u4f7f\u308f\u306a\u3044\u30bf\u30a4\u30de\u30fc(Office VBA)<\/a>\u300d\u3067\u7d39\u4ecb\u3057\u3066\u3044\u308b\u3088\u3046\u306a\u65b9\u6cd5\u3067\u3001<span style=\"color: #ff0000; font-weight: bold;\">setTimeout<\/span>\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u51e6\u7406\u3092\u884c\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">'\u30af\u30e9\u30b9\u30e2\u30b8\u30e5\u30fc\u30eb(Class1)\r\nOption Explicit\r\n\r\nPrivate d As Object\r\n\r\nPublic Sub SetTimeoutProc()\r\n  Set d = CreateObject(&quot;htmlfile&quot;)\r\n  Set d.parentWindow.onhelp = Me\r\n  'setTimeout\u3067\u6642\u9593\u5dee\u5b9f\u884c\r\n  d.parentWindow.setTimeout &quot;onhelp.CloseBackStage&quot;, 100, &quot;VBScript&quot;\r\nEnd Sub\r\n\r\nPublic Sub CloseBackStage()\r\n'\u30d0\u30c3\u30af\u30b9\u30c6\u30fc\u30b8\u3092\u9589\u3058\u308b\r\n  Dim uiAuto As CUIAutomation\r\n  Dim elmFileTab As IUIAutomationElement\r\n  Dim cndFileTab As IUIAutomationCondition\r\n  Dim acc As IUIAutomationLegacyIAccessiblePattern\r\n  Const STATE_SYSTEM_NORMAL = 0\r\n  \r\n  Set uiAuto = New CUIAutomation\r\n  Set cndFileTab = uiAuto.CreatePropertyCondition( _\r\n                     UIA_AutomationIdPropertyId, _\r\n                     &quot;FileTabButton&quot; _\r\n                   )\r\n  Set elmFileTab = uiAuto.GetRootElement.FindFirst( _\r\n                     TreeScope_Subtree, _\r\n                     cndFileTab _\r\n                   )\r\n  If Not elmFileTab Is Nothing Then\r\n    Select Case elmFileTab.GetCurrentPropertyValue( _\r\n                  UIA_LegacyIAccessibleStatePropertyId _\r\n                )\r\n      Case STATE_SYSTEM_NORMAL\r\n        Set acc = elmFileTab.GetCurrentPattern( _\r\n                    UIA_LegacyIAccessiblePatternId _\r\n                  )\r\n        acc.DoDefaultAction\r\n    End Select\r\n  End If\r\nEnd Sub<\/pre>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u8a2d\u5b9a\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u304d\u3001\u300c\u30d5\u30a1\u30a4\u30eb \u30bf\u30d6\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u3068\u3001\u30e1\u30c3\u30bb\u30fc\u30b8\u304c\u8868\u793a\u3055\u308c\u305f\u5f8c\u3001\u4e00\u77ac\u3060\u3051Backstage \u30d3\u30e5\u30fc\u304c\u8868\u793a\u3055\u308c\u3001\u3059\u3050\u306b\u9589\u3058\u3089\u308c\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"\/\/www.ka-net.org\/blog\/wp-content\/uploads\/ProhibitionBackstageView_01.gif\" alt=\"ProhibitionBackstageView_01\" width=\"497\" height=\"359\" class=\"alignnone size-full wp-image-6597\" \/><\/p>\n<p>\u4ed5\u69d8\u4e0a\u3069\u3046\u3057\u3066\u3082\u4e00\u5ea6Backstage \u30d3\u30e5\u30fc\u304c\u8868\u793a\u3055\u308c\u3066\u3057\u307e\u3046\u306e\u3067\u3059\u304c\u3001\u64cd\u4f5c\u3067\u304d\u308b\u307b\u3069\u306e\u6642\u9593\u306f\u7121\u3044\u306f\u305a\u306a\u306e\u3067\u3001\u76ee\u7684\u306f\u9054\u3057\u3066\u3044\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n<p>\u305f\u3060\u3001\u4ee5\u524d\u5f53\u30d6\u30ed\u30b0\u3067\u3082\u66f8\u3044\u305f\u3088\u3046\u306b(\u300c<a href=\"\/\/www.ka-net.org\/blog\/?p=4808\" title=\"VBA\u3067\u25cb\u25cb\u3092\u7981\u6b62\u3057\u305f\u3044\uff01\u30fb\u30fb\u30fb\u3068\u601d\u3046\u524d\u306b\u3002 | \u521d\u5fc3\u8005\u5099\u5fd8\u9332\" target=\"_blank\">VBA\u3067\u25cb\u25cb\u3092\u7981\u6b62\u3057\u305f\u3044\uff01\u30fb\u30fb\u30fb\u3068\u601d\u3046\u524d\u306b\u3002<\/a>\u300d\u53c2\u7167)\u3001\u3053\u3046\u3044\u3063\u305f\u7981\u6b62\u7cfb\u306e\u51e6\u7406\u3092\u30de\u30af\u30ed\u3067\u884c\u3046\u5fc5\u8981\u304c\u3042\u308b\u306e\u304b\u3069\u3046\u304b\u3001\u4e8b\u524d\u306b\u4e00\u5ea6\u691c\u8a0e\u3059\u308b\u3053\u3068\u3092\u304a\u85a6\u3081\u3057\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u6570\u5e74\u524d\u30db\u30fc\u30e0\u30da\u30fc\u30b8\u3067\u300c\u30d5\u30a1\u30a4\u30eb\u30bf\u30d6\u30dc\u30bf\u30f3\u306e\u30af\u30ea\u30c3\u30af\u3092\u7981\u6b62\u3059\u308b(Office 2010)\u300d\u3068\u3044\u3046\u8a18\u4e8b\u3092\u516c\u958b\u3057\u305f\u306e\u3067\u3059\u304c\u3001\u5148\u65e5Excel 2013\u74b0\u5883\u3067\u4f7f\u3048\u306a\u3044\u3001\u3068\u306e\u8cea\u554f\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u4f55\u305bOffice 2010 Publi [&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":"[[VBA]\u30d5\u30a1\u30a4\u30eb\u30bf\u30d6(Backstage \u30d3\u30e5\u30fc)\u306e\u8868\u793a\u3092\u7981\u6b62\u3059\u308b]","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,128],"tags":[],"class_list":["post-6596","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-excel-office","category-word-office","category-powerpoint","category-office2016"],"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-1Io","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6596","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=6596"}],"version-history":[{"count":1,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6596\/revisions"}],"predecessor-version":[{"id":6598,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6596\/revisions\/6598"}],"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=6596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}