{"id":69643,"date":"2005-06-08T13:18:00","date_gmt":"2005-06-08T13:18:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2005\/06\/08\/how-can-i-hide-a-specific-toolbar-in-microsoft-word\/"},"modified":"2005-06-08T13:18:00","modified_gmt":"2005-06-08T13:18:00","slug":"how-can-i-hide-a-specific-toolbar-in-microsoft-word","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/how-can-i-hide-a-specific-toolbar-in-microsoft-word\/","title":{"rendered":"How Can I Hide a Specific Toolbar in Microsoft Word?"},"content":{"rendered":"<p><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Question\" border=\"0\" alt=\"Hey, Scripting Guy! Question\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" width=\"34\" height=\"34\"> \n<P>Hey, Scripting Guy! How can I hide a specific toolbar in Microsoft Word?<BR><BR>&#8212; AG<\/P><IMG border=\"0\" alt=\"Spacer\" src=\"https:\/\/devblogs.microsoft.com\/scripting\/wp-content\/uploads\/sites\/29\/2019\/05\/spacer.gif\" width=\"5\" height=\"5\"><IMG class=\"nearGraphic\" title=\"Hey, Scripting Guy! Answer\" border=\"0\" alt=\"Hey, Scripting Guy! Answer\" align=\"left\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" width=\"34\" height=\"34\"><A href=\"http:\/\/go.microsoft.com\/fwlink\/?linkid=68779&amp;clcid=0x409\"><IMG class=\"farGraphic\" title=\"Script Center\" border=\"0\" alt=\"Script Center\" align=\"right\" src=\"http:\/\/img.microsoft.com\/library\/media\/1033\/technet\/images\/scriptcenter\/ad.jpg\" width=\"120\" height=\"288\"><\/A> \n<P>Hey, AG. Now this question brings back memories. When our editor joined the team one of her first actions was to make us redo a whole bunch of screenshots we had made for the Scripting Week 2 webcasts. Why? Because she didn\u2019t think we should include screenshots that showed a custom Microsoft Word toolbar we use when working with content for the Script Center. Thus we had to open Word, hide the toolbar, and redo all the screenshots. If we\u2019d had a script like the one you\u2019re looking for, we wouldn\u2019t have had to manually open Word and hide the toolbar. Granted that wouldn\u2019t have been a <I>huge<\/I> time savings, but, still\u2026.<\/P>\n<TABLE id=\"E3C\" class=\"dataTable\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\"><B>Note<\/B>. We kid our editor from time-to-time, but, really, we have no complaints about her whatsoever. Well, OK, it <I>would<\/I> be nice if she\u2019d only use one parking space when parking her broomstick each morning, but other than that\u2026.<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>But let\u2019s get down to business. You want a script that can hide a specific toolbar in Microsoft Word, right? Well, how about this simple little script, which hides the <B>Formatting<\/B> toolbar:<\/P><PRE class=\"codeSample\">Set objWord = CreateObject(&#8220;Word.Application&#8221;)\nobjWord.Visible = True\nSet objTool = objWord.CommandBars(&#8220;Formatting&#8221;)\nobjTool.Visible = False\n<\/PRE>\n<P>As you can see, it\u2019s a simple task &#8211; hide a toolbar &#8211; and an equally simple script. We begin by creating an instance of the <B>Word.Application<\/B> object and then setting the <B>Visible<\/B> property to True (just so we can see what\u2019s going on). We then use this line of code to create an object reference to the <B>Formatting<\/B> toolbar, which is part of the Word <B>CommandBars<\/B> collection:<\/P><PRE class=\"codeSample\">Set objTool = objWord.CommandBars(&#8220;Formatting&#8221;)\n<\/PRE>\n<P>To hide the toolbar we simply set the toolbar\u2019s <B>Visible<\/B> property to False. If we wanted to show the toolbar all we\u2019d have to do is set the Visible property to True.<\/P>\n<P>No doubt one question that immediately pops into mind is this: how did we know this particular toolbar has the name <I>Formatting<\/I>? Well, if you click the <B>View<\/B> menu in Word and then click <B>Toolbars<\/B> you\u2019ll see a list of the toolbars available. The names shown in the menu are the same names you use in your scripts.<\/P>\n<TABLE id=\"EPE\" class=\"dataTable\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\"><B>Note<\/B>. Couldn\u2019t we just enumerate all the items in the CommandBars collection to retrieve a list of toolbar names? Yes, we could. Unfortunately, though, the CommandBars collection also includes menus, shortcut menus, and submenus, and there doesn\u2019t appear to be a way to programmatically separate toolbars from these other items. Therefore your best bet is just to open Word and take a look at the toolbar names.<\/P><\/TD><\/TR><\/TBODY><\/TABLE>\n<DIV class=\"dataTableBottomMargin\"><\/DIV>\n<P>The script we showed you actually opens up Word, hides the toolbar, and then leaves Word open. If you\u2019d rather just configure the toolbar setting without seeing anything on screen you can use this script, which starts up Word in a hidden window, hides the toolbar, and then exits the program. You won\u2019t see anything happen on screen, but the next time you start Word the Formatting toolbar will be hidden:<\/P><PRE class=\"codeSample\">Set objWord = CreateObject(&#8220;Word.Application&#8221;)\nSet objTool = objWord.CommandBars(&#8220;Formatting&#8221;)\nobjTool.Visible = False\nobjWord.Quit\n<\/PRE>\n<P>One final point we should make is that &#8211; as we\u2019ve seen &#8211; it\u2019s possible to <I>hide<\/I> a toolbar in Word. However, the toolbar will still be available: it just won\u2019t be visible at the moment. For better or worse (probably for better) you can\u2019t delete any of Word\u2019s built-in toolbars; the best you can do is hide them from view.<\/P>\n<P>Anyway, thanks for your question AG. And now we have a question for you. We\u2019d like to get our editor a small token of our appreciation, but we have no idea where to find eye of newt in the Seattle area. Any ideas?<\/P>\n<TABLE id=\"ECF\" class=\"dataTable\" cellSpacing=\"0\" cellPadding=\"0\">\n<THEAD><\/THEAD>\n<TBODY>\n<TR class=\"record\" vAlign=\"top\">\n<TD>\n<P class=\"lastInCell\"><B>Editor\u2019s Note<\/B>. The preceding was a work of fiction (with the exception of the scripting material). Any resemblance to editors past or present is purely coincidental. Although there is <I>no<\/I> resemblance to editors present. Past, well\u2026.<\/P><\/TD><\/TR><\/TBODY><\/TABLE><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey, Scripting Guy! How can I hide a specific toolbar in Microsoft Word?&#8212; AG Hey, AG. Now this question brings back memories. When our editor joined the team one of her first actions was to make us redo a whole bunch of screenshots we had made for the Scripting Week 2 webcasts. Why? Because she [&hellip;]<\/p>\n","protected":false},"author":595,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[84,49,3,5,395],"class_list":["post-69643","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-microsoft-word","tag-office","tag-scripting-guy","tag-vbscript","tag-word-application"],"acf":[],"blog_post_summary":"<p>Hey, Scripting Guy! How can I hide a specific toolbar in Microsoft Word?&#8212; AG Hey, AG. Now this question brings back memories. When our editor joined the team one of her first actions was to make us redo a whole bunch of screenshots we had made for the Scripting Week 2 webcasts. Why? Because she [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69643","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/595"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=69643"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/69643\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=69643"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=69643"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=69643"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}