Hi
I am getting error on belwo line "User-defined type not defined".
Public Function RetrieveImageFromAPI(apiUrl As String, UserName As sring, Pwd As String, TrNo As String) As StdPicture
Thanks
Hi
I am getting error on belwo line "User-defined type not defined".
Public Function RetrieveImageFromAPI(apiUrl As String, UserName As sring, Pwd As String, TrNo As String) As StdPicture
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Eliana BlakePosted Mar 19, 2025, 1:46 PM
It seems like the error "User-defined type not defined" is related to the use of the `StdPicture` type in your VBA code. The `StdPicture` type is not a built-in type in VBA but rather a part of various third-party libraries or APIs.
To resolve this error, you will need to ensure that the `StdPicture` type is properly defined in your VBA project. Here are a few steps you can take to address this issue:
1. Include the Necessary Reference:
- If `StdPicture` is part of a specific library or API (like Microsoft Forms 2.0 Library), you need to include the reference to that library in your VBA project. To do this, go to the VBA editor, click on "Tools" in the top menu, then go to "References" and check the appropriate library that contains the `StdPicture` type.
2. Check for Spelling Errors:
- Ensure that there are no spelling mistakes in the declaration of the `StdPicture` type. It should be `StdPicture` and not a misspelled version.
3. Verify Data Types:
- Double-check that all variable types in your function declaration match the actual data types. For example, I noticed a typo in your code where you have `UserName As sring`; it should be `UserName As String`.
4. Compile the Code:
- After making any changes, try to compile the code to check for any syntax errors that might be causing the "User-defined type not defined" issue.
Here is an example of how your function should look after correcting the typo and assuming `StdPicture` is from the Microsoft Forms 2.0 Library:
By following these steps and ensuring proper definition and reference to the `StdPicture` type, you should be able to resolve the "User-defined type not defined" error in your VBA code.