title: VBE How to collapse worksheets by default
body: <p>I work with several workbooks containing 10-15 Worksheets and several modules.</p>
  
  <p>Whenever I open the VBA-Editor, or bring it back into focus, the project explorer has expanded the "Microsoft Excel objects" (mostly worksheets) and collapsed the moduls, which is exactly the opposite of what I want.</p>
  
  <p>As I have about 15 Worksheets in each workbook, seeing all of them in the explorer makes it very impractical, as in the VBA-Editor i am mainly concerned about the code in the modules.</p>
  
  <p>How can I change the default to: "Show modules and collapse 'Microsoft Excel objects' in the Project viewer"?</p>
  
  <p>Edit: I added a picture, to show the unwanted default. Now i would like the default to be "Microsoft Excel Objects" collapsed and "Modules" expanded instead:</p>
  
  <p><img src="https://i.stack.imgur.com/GRwHN.jpg" alt="enter image description here"></p>
  
  <p>Edit: The solution provided a macro. To come close to the "default" I added it to the commandbar of the VBE, accessible with a shortcut-stroke as follows: I took the second part of the answer to mehow's question <a href="https://stackoverflow.com/questions/17041881/hook-into-a-child-class-systreeview32-of-vbe-window">here</a> and put it in a code module. Then I applied <a href="http://www.cpearson.com/excel/VbeMenus.aspx" rel="nofollow noreferrer">these</a> instructions, to create the CommandBar entry. Then I Added the ampersand in front of the desired letter in the caption and now I can use Alt+t,t to collapse the Microsoft Excel Objects and open the rest.</p>