+ Reply to Thread
Results 1 to 7 of 7

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 have here a code provided by JasperD (@thanks) to retrieve an actual price of a stock from Google Finance.
    Please Login or Register  to view this content.
    Unfortunetlly when I try to make it run it appears a "Compile error: User-defined type not defined." on the second line of the code "Dim http As New MSXML2.XMLHTTP"
    I believe I've omited include some refrences.
    Here's what I've additionaly mark off in Tools-References:
    • Microsoft XML, v6
    • Microsoft HTML Object Library
    Does somebody know what I've done worng?
    Thank you in advance.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: User-defined type not defined

    Maybe you need to reference an earlier version.
    Referencing MSXML within VBA Projects

    EDIT: I copied your code and referenced V6 and didn't have a problem, but I would still recommend you try a lower version to see if that works for you. I will do further research and pass along anything I find out.


    User-defined type not defined even after adding reference from file


    Google Search
    Last edited by skywriter; 05-09-2015 at 02:22 PM.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: User-defined type not defined

    Try using winhttp request (Set reference to Microsoft WinHTTP Request 5.1)

    Please Login or Register  to view this content.
    Both work for me, so no idea why XML won't do it for you.
    Please click the * below if this helps
    Please click the * below if this helps

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

    Re: User-defined type not defined

    I've tried all versions. I am totalynew to excel programming, perhaps I am doing something fundamentally wrong.
    Could you please see my spreadsheet? It's a bit messy but readeable.
    Trade Journal.xlsm

  5. #5
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: User-defined type not defined

    It works fine for me.
    But, if you want to get the stockquote directly from a stock name, you have to put it between quotes " "
    =Stockquote(AAPL) will end up in a #value
    =Stockquote("AAPL") will end up in the stock value of Apple.

    =Stockquote(B5) works too.

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

    Re: User-defined type not defined

    What a silly mistake I've omited! I was focused on VBA programming and did not notice I am missing the quote marks.
    Finally I am free to enhance futher the spreasheet for another features.
    Thank you very much, works nice now.

  7. #7
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: User-defined type not defined

    Great to hear. Please mark this thread as solved.

    If you're happy with the assistance received, please click * Add reputation to show your gratitude.

+ 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. [SOLVED] MSForms.CommandButton = User-defined Type not defined
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-30-2015, 07:35 AM
  2. Compile error: User- defined type not defined
    By rolex in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-14-2015, 05:08 PM
  3. Compile error: user defined type not defined
    By duhigs in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-23-2014, 07:51 PM
  4. compile error - user defined type not defined
    By TMP123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-23-2010, 01:42 PM
  5. VB Compile Error - User-defined type not defined
    By dbwiz in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-08-2010, 04:31 PM

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