In Excel, the stdole32.tlb file is a Type Library that defines the COM (Component Object Model) interfaces and classes used by Excel to interact with external applications or components.
What is stdole32.tlb?
-
It is a Microsoft COM Type Library that contains the Microsoft Office Object Model.
-
It is used by Excel to expose its object model to COM components, such as VBA (Visual Basic for Applications), automation, or other .NET applications.
-
This file is located in the following directory on a standard Windows system:
C:\Program Files\Microsoft Office\Office<version>\stdole32.tlb(e.g.,
C:\Program Files\Microsoft Office\Office16\stdole32.tlbfor Excel 2016)
How to Use stdole32.tlb in Excel
If you're using VBA or C# or VB.NET to interact with Excel, you'll need to reference this Type Library in your project.
Example: Using stdole32.tlb in VBA
-
Open the VBA editor in Excel.
-
Insert a new module or use an existing one.
-
Reference the Type Library:
Dim xlApp As Object Set xlApp = CreateObject("Excel.Application")This works because Excel's COM object model is exposed through
stdole32.tlb.
How to Reference stdole32.tlb in a .NET Project
If you're using C# or VB.NET, you can reference the Type Library via the Add Reference dialog:
- Right-click on your project in the Solution Explorer.
- Choose "Add Reference".
- Go to "COM" > Microsoft Office > stdole32.tlb.
- Click "OK".
Notes
- The file is not part of the Excel installation, but it's required for COM-based automation.
- It is not the same as
ole32.tlboroleaut32.tlb— these are different type libraries used in COM interop. - If you're using Excel 365 or Office 365, the file might be in a different location, or it might not be present at all.
Summary
| Component | Description |
|---|---|
stdole32.tlb |
COM Type Library for Excel's Object Model |
| Used in | VBA, C#, VB.NET, Excel automation |
| Location | C:\Program Files\Microsoft Office\Office<version>\stdole32.tlb |
| Required | Yes, for COM-based Excel automation |
If you're using a specific version of Excel or need to reference it in a specific language, let me know, and I can provide a more tailored example!