# Excel Add-In: “Compile error: User-defined type not defined” when running VBA script.

**URL:** <https://community.cdata.com/t/excel-add-in-compile-error-user-defined-type-not-defined-when-running-vba-script/437>\
**Category:** Editions\
**Tags:** article, excel, data, table, vba, script\
**Created:** [October 5, 2023, 9:00pm UTC](https://community.cdata.com/t/excel-add-in-compile-error-user-defined-type-not-defined-when-running-vba-script/437 "2023-10-05T21:00:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Skerdian\_Shehaj](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/skerdian_shehaj/32/1243_2.png) [@Skerdian\_Shehaj](https://community.cdata.com/u/Skerdian_Shehaj)\
**Post date:** [October 5, 2023, 9:00pm UTC](https://community.cdata.com/t/excel-add-in-compile-error-user-defined-type-not-defined-when-running-vba-script/437/1 "2023-10-05T21:00:15Z")

</div>

![c272d3cc-cab4-421b-ad1f-aa3b578ee1de.png](https://us1.discourse-cdn.com/cdata/original/1X/44b28a5d6d944adb71a8d3f9cd02964db60eeb47.png)

If you are encountering this issue, it is most likely because you have not added the CData Excel Add-In as a reference in your Visual Basic module/script. To add the CData Excel Add-In as a reference, please follow these three simple steps:

1. Once you have opened VBA, navigate to Tools → References.

 ![17eedc48-43d8-40a1-88c9-7c377c82b5fb.png](https://us1.discourse-cdn.com/cdata/original/1X/fad420e495f239dcc392d952184f1205376c8a63.png)

1. Locate the CData Excel Add-In, check the box next to it, and then click OK.

 ![e8a9d7d3-b6ec-45fe-8b06-ee765e228864.png](https://us1.discourse-cdn.com/cdata/original/2X/7/783ac5c8a3a01355778caabc9033ca26010848f9.png)

1. Run the script, and the error will no longer occur.

 ![ed478fc6-16a7-4a72-a5a6-b695eea60af6.png](https://us1.discourse-cdn.com/cdata/original/2X/b/bbb64f94949c9e7373132d8acc94254f9f8975a8.png)

If this solution does not resolve the problem, please feel free to reach out to our support team at [support@cdata.com](mailto:support@cdata.com) for further assistance.
