top of page
  • John

Type Library explorer

If you're not sure what a Type Library is and what it's got to do with VBA, before reading this post you might want to read the 'What's a Type Library and what do they do for VBA?' section of my Adding / updating "Project References" in the VBE post. If you don't fancy that, it might help to know that one well-used Type Library is the Microsoft Scripting Runtime which contains the FileSystemObject and Dictionary classes.


But have you ever wanted to know what is in a Type Library without having to first add a Project Reference to it from your VBA Project and then trying to poke around in the dark finding out what it contains? Well, there's two ways of doing that:


Use the oleview.exe application


The oleview.exe application should be available by default on all Windows devices ... to locate it on your device, see https://superuser.com/a/1790400/1823358 ... once opened, in the left-hand menu/window click to expand the 'Type Libraries' item, scroll to the Type Library you are interested in and then:


  • Single-click it to see a brief summary of key data about the Type Library - this data comes from the HKEY_CLASSES_ROOT\Typelib key in the Registry and you might notice that this matches the data shown for each Type Library in the VBE_Extras 'Update "Project References"' dialog (Name, Version, GUID, Flags, language etc)

  • Double-click it to see details of the Types, Functions and Variables it contains


Use VBE_Extras Type Library explorer


Open the 'Update "Project References"' dialog by right-clicking on the relevant VBA Project in the VBE's Project Explorer window. Right-click on the Type Library you want to explore (either one of the "Current" References or one of the "Available" References") and select 'Explore'. You'll see something like this:


Type Library explorer

If you've ever used the Microsoft Scripting Runtime Type Library then you should recognise some of the the content of the above image in which you can see:

  • The CompareMethod Enum and its members

  • The Dictionary Class and its members

  • The Drive Class and its members

  • The Drives Class and the first of its members

  • ... obviously scrolling down would show all of the the other Enums, Classes, members etc of the Type Library


By default, the members are displayed in a parent / child 'tree view' such that child members only appear within their parent. However, this is not how the VBE displays members of Modules or Enumerations … the VBE shows them in a 'flat hierarchy' as though they were also 'top level' members. If you prefer the VBE 'flat hierarchy' then you can enable this in the 'Code' tab of VBE_Extras Settings.

 

Hidden members of the Type Library are shown if you have the 'show hidden members' setting switched on (in the Object Browser, right click on any Member and select 'Show Hidden Members', or use the VBE_Extras function of the same name in the main menu). You can see this in the above image: the GetHashVal Property of the Dictionary Class is a hidden member (when shown, hidden members are shown in grey text).

bottom of page