Results 1 to 2 of 2
  1. #1
    Bronze Lounger
    Join Date
    Nov 2001
    Arlington, Virginia, USA
    Thanked 3 Times in 3 Posts

    Get Enum & Type Lib Info (VB/VBA 6.0)

    I've seen the question in past if there was any way to "capture" the constant names (and values) enumerated in an Enum defined in a type library. I never had any luck with this till recently when chanced upon some MSKB articles describing the somewhat obscure TLI (TypeLib Information) library (TLBINF32.DLL) that is installed with Visual Studio 6.0. As name implies, this file allows you to obtain Type Library information from external libraries. To use it you need to set a reference to "TypeLib Information" in References dialog.

    For anyone interested, the attached text file provides an example showing how to "capture" Enum info into an array of a user-defined type (EnumInfo), given the library name (as appears in Object Browser) and name of enum. The test sub populates an UDT array with the VBA Variable Type (VbVarType) enum constant names & values, then prints them out. I'm not sure if there's a practical use for this, but thought it was a neat trick....

    There's lots of other stuff you can do with TLI. See these MSKB articles for more info:

    MSKB 239930 - HOWTO: Obtain Built-In Constant Values for an Office Application

    MSKB 172988 - SAMPLE: CLSNMMBR.EXE Programmatically Retrieves the Members of a DLL Class

    MSKB 224331 - FILE: Tlbinf32.exe : Help Files for Tlbinf32.dll

    CAVEAT: As noted in MSKB, "The tlbinf32.dll file and the HTML Help file are provided for your reference only, and they are not supported by Microsoft." And: "The file Tlbinf32.dll is not supported by Microsoft Technical Support either electronically or via telephone. This file is subject to change without notice." In other words, use at own risk....

    To import attached text file into a project, change file extension to ".BAS".

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Weert, Limburg, Netherlands
    Thanked 0 Times in 0 Posts

    Re: Get Enum & Type Lib Info (VB/VBA 6.0)

    I know Chip Pearson has fooled around with the TLI stuff. There should be some examples on his site:
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    Professional Office Developers Association

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts