Overview
If you see the error message 'Compile Error: User-defined type not defined' when trying to open a spreadsheet report, this usually indicates a missing reference in the spreadsheet's VBA code. You can resolve this by checking and updating the references.
Check and update references
To fix this error, follow these steps:
Open the VBA Editor by pressing Alt + F11 on your keyboard.
Click Tools, then click References.
Look for any references marked as MISSING.
If you find a missing reference, clear its checkbox, then click OK.
You should now be able to open and run the spreadsheet as normal.
Re-register the WinSCP.dll file
If the issue continues after checking references, the Excel file may be corrupted or the WinSCP.dll file may need re-registering. Contact your internal IT team and ask them to follow these steps:
Click the Start menu.
Type cmd, then right-click Command Prompt.
Select Run as administrator.
Locate your WinSCP folder (commonly in C:\Program Files (x86)).
Execute these commands:
%WINDIR%\Microsoft.NET\Framework\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase /tlb:WinSCPnet32.tlb
%WINDIR%\Microsoft.NET\Framework64\v4.0.30319\RegAsm.exe WinSCPnet.dll /codebase /tlb:WinSCPnet64.tlb
Still need help?
If these steps don't resolve the issue, contact our Support team. When you raise your case, include:
The title of this article.
The name of the affected spreadsheet report.
The exact error message you can see
