If you’d 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. The script we showed you actually opens up Word, hides the toolbar, and then leaves Word open. Therefore your best bet is just to open Word and take a look at the toolbar names. Unfortunately, though, the CommandBars collection also includes menus, shortcut menus, and submenus, and there doesn’t appear to be a way to programmatically separate toolbars from these other items. Couldn’t we just enumerate all the items in the CommandBars collection to retrieve a list of toolbar names? Yes, we could. The names shown in the menu are the same names you use in your scripts. No doubt one question that immediately pops into mind is this: how did we know this particular toolbar has the name Formatting? Well, if you click the View menu in Word and then click Toolbars you’ll see a list of the toolbars available. If we wanted to show the toolbar all we’d have to do is set the Visible property to True. To hide the toolbar we simply set the toolbar’s Visible property to False. We then use this line of code to create an object reference to the Formatting toolbar, which is part of the Word CommandBars collection: Set objTool = objWord.CommandBars(“Formatting”) We begin by creating an instance of the Word.Application object and then setting the Visible property to True (just so we can see what’s going on). Set objTool = objWord.CommandBars(“Formatting”)Īs you can see, it’s a simple task – hide a toolbar – and an equally simple script. You want a script that can hide a specific toolbar in Microsoft Word, right? Well, how about this simple little script, which hides the Formatting toolbar: Set objWord = CreateObject(“Word.Application”)
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |