- Legacy macro downloaded from the internet or have been developed in-house some time ago failed to run. Can’t find project or library error is displayed and of the SOLIDWORKS declarations are highlighted.
Alternatively non-SOLIDWORKS declarations can be highlighted (such as Left or Mid functions)
- If the libraries were never selected in the macro the Compile error: user-defined type not defined can be displayed.
Macro is pointing to older versions of SOLIDWORKS type libraries and cannot resolve them automatically. As the result the libraries are marked as MISSING.
SOLIDWORKS type libraries were never selected or were explicitly deselected in the macro (this usually happens when macro is converted from *.swp macro)
- Open the macro for editing via Tools->Macro->Edit menu
- Navigate to Tools->References menu in the VBA editor
- Select the SOLIDWORKS type libraries as shown below. If libraries cannot be found in the Available References list use Browse… button and find the sldworks.tlb, swconst.tlb, swcommands.tlb in the installation folder of SOLIDWORKS.
- If libraries are selected or MISSING keyword is present it is required to force update the references by following the steps below:
- Uncheck all of the libraries which are referencing SOLIDWORKS. (including libraries with MISSING keyword next to them)
- Click OK
- Open the same dialog again and check corresponding SOLIDWORKS libraries. Those are usually available in the references list. If not you can use ‘Browse…’ button to manually select the libraries from the SOLIDWORKS installation folder
Alternatively you can copy paste all the code to newly created macro.