+ Reply to Thread
Results 1 to 5 of 5

"User-defined type not defined"

  1. #1
    Registered User
    Join Date
    05-02-2015
    Location
    Czech Republic
    MS-Off Ver
    2013
    Posts
    28

    "User-defined type not defined"

    Hello,

    I am new to Excel Programming and I've got compile error says "User-defined type not defined" at the second line of my code (Dim HTTP).
    I am trying to create a button which will display in a cell an actual exchange rate of USD and CZK (Czech Crone - my national currency).
    Here's what I've tried to writte:
    Please Login or Register  to view this content.
    Does anybody know what's wrong with that?
    Any help would be aprreciate.

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: "User-defined type not defined"

    Hi jirakst,

    You are probably missing a library reference because you are using early binding. In the VBA environment, you probably need: Tools > Reference > Microsoft WinHTTP Services, Version x.x (where x.x is the version number on your computer).

    For a discussion of Early Binding vs. Late Binding and examples see:
    https://msdn.microsoft.com/en-us/library/0tcf61s1.aspx
    http://peltiertech.com/Excel/EarlyLateBinding.html

    Lewis

  3. #3
    Registered User
    Join Date
    05-02-2015
    Location
    Czech Republic
    MS-Off Ver
    2013
    Posts
    28

    Re: "User-defined type not defined"

    Hello LJMetzger,

    thank you for your answer.
    I've add the library but insted of compile error received runtime error '424': Object required.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: "User-defined type not defined"

    Try the following code that works me (value of 24.416) using Late Binding. That means you can remove the library reference.

    Please Login or Register  to view this content.
    To prevent typos from ruining days and weeks of work 'Option Explicit' is NEEDED at the top of each code module. This prevents errors caused by missspellings and FORCES every variable to be DECLARED (e.g. Dim i as Integer). http://www.cpearson.com/excel/DeclaringVariables.aspx

    Lewis

  5. #5
    Registered User
    Join Date
    05-02-2015
    Location
    Czech Republic
    MS-Off Ver
    2013
    Posts
    28

    Re: "User-defined type not defined"

    Dear LJMetzger,

    I have copy your code, edit
    Please Login or Register  to view this content.
    and it works exactly as I was trying to manage.
    It will help well my personal project for money managment.
    Thank you really much for your help!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. "for each" loop in controls to populate user-defined type
    By njs27 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-24-2015, 04:57 PM
  2. Error message: "Compile error. User-defined type not defined"
    By freckles81 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 06-13-2012, 09:37 AM
  3. Error message: "Compile error. User-defined type not defined"
    By lottesfog in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2007, 06:38 PM
  4. "User-defined type not defined" error when trying to send e-mail
    By SupperDuck in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-02-2006, 02:40 AM
  5. [SOLVED] "User-defined type not defined" message in Excel
    By RW1946 in forum Excel General
    Replies: 0
    Last Post: 08-31-2005, 08:05 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1