Type Libraries
This topic describes how to reference:
SolidWorks Type Libraries
To reference the SolidWorks type libraries, sldworks.tlb and swconst.tlb:
If programming in this language... |
Then... |
Microsoft C++ 6.0 and Microsoft C++/CLI |
In the precompiled header file, include:
#import "path_and_filename"
for each SolidWorks type library that you are referencing. Path and
filenames for each SolidWorks type library are:
disk:\<SolidWorks_install_dir>\sldworks.tlb
disk:\<SolidWorks_install_dir>\swconst.tlb |
|
|
Microsoft VBA |
If you recorded a SolidWorks macro, the SolidWorks type libraries are
automatically referenced.
- or -
To include the SolidWorks type libraries manually:
In an open project in VBA, click Tools,
References.
Select:
Click OK.
If a VBA macro created in an earlier version of SolidWorks will not
run after upgrading to a new version of SolidWorks, see VBA
Macros, Type Libraries, and SolidWorks Upgrades for help. |
|
|
Microsoft Visual Basic for Applications (VBA) |
In an open project in Visual Basic, click Project, References.
Select SolidWorks
version Constant
type library.
Click OK.
|
Microsoft Visual Basic .NET or
Microsoft Visual C# .NET |
In an open project in Microsoft Visual Studio
.NET:
Click Project,
Add Reference.
Click the COM
tab.
Select:
Click OK.
|
User-specified Type Libraries
You can also add and remove references to user-specified type libraries.
A user-specified type library first appears on
the list of available references only after adding it and only after recording
a macro.
User-specified type library references are not
persistent across SolidWorks sessions.
Only macros created after adding a user-specified
type library reference can reference that type library.
See these topics for details about adding and removing references to
user-specified type libraries: