You may face “User-defined type not defined” error as you declare Excel specific variables. This issue is little tricky.
Your code may be like this:
Dim xlApp As Excel.Application Dim xlWB As Excel.Workbook Dim xlSheet As Excel.Worksheet

Solution
This error occurs because of the missing reference. You should add Excel reference before declaring Excel objects. To get rid of this error:
1 thought on “Solved: “User-defined type not defined” error at declarations of Excel variables (VBA)”