+ Reply to Thread
Results 1 to 8 of 8

Error on VBA code for pull or extract data from HTML Element in Excel

  1. #1
    Registered User
    Join Date
    06-11-2020
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    6

    Error on VBA code for pull or extract data from HTML Element in Excel

    Hello everyone
    I try to to extract or get data from HTML Element in Excel using VBA code as per attached file named "VBA code - Extract Data from HTML web".
    My idea is to extract the exchange rate data in red highlight from the HTML website as below quote and unquote:

    Quote//
    SG : 1.3006 SGD = 100 JPY 2020-06-15 MAS noon buying
    100 Japanese Yen buys 1.3006 Singapore Dollars
    SG : 1.3001 SGD = 100 JPY 2020-06-12 MAS noon buying
    100 Japanese Yen buys 1.3001 Singapore Dollars
    SG : 1.2986 SGD = 100 JPY 2020-06-11 MAS noon buying
    100 Japanese Yen buys 1.2986 Singapore Dollars
    SG : 1.2887 SGD = 100 JPY 2020-06-10 MAS noon buying
    100 Japanese Yen buys 1.2887 Singapore Dollars
    SG : 1.2857 SGD = 100 JPY 2020-06-09 MAS noon buying
    100 Japanese Yen buys 1.2857 Singapore Dollars
    SG : 1.2726 SGD = 100 JPY 2020-06-08 MAS noon buying
    100 Japanese Yen buys 1.2726 Singapore Dollars
    SG : 1.2773 SGD = 100 JPY 2020-06-05 MAS noon buying
    100 Japanese Yen buys 1.2773 Singapore Dollars

    Unquote//

    Unfortunately, when i try to run the code, it compile the error as "run-time error 445" and "object doesn't support this action"

    Appreciate someone can guide me to find out what is the error.
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by rayhee1985; 06-15-2020 at 12:24 PM.

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Question Re: Error on VBA code for pull or extract data from HTML Element in Excel


    Hi,

    you are using a class which obviously does not exist in the webpage ! So where did you find it ?

  3. #3
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Error on VBA code for pull or extract data from HTML Element in Excel

    Did you consider using API ..?
    Try the following code
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  4. #4
    Registered User
    Join Date
    06-11-2020
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    6

    Re: Error on VBA code for pull or extract data from HTML Element in Excel

    YasserKhalil, thank you very much for your help.
    I try to run the code as given but it is compile error "Run time error "424":Object require" on Set GetJSON = JSONConverter.ParseJson(.responseText).
    Last edited by rayhee1985; 06-15-2020 at 10:57 PM.

  5. #5
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Error on VBA code for pull or extract data from HTML Element in Excel

    Hello
    Sorry I forgot to mention about that point ..

    Go to the following link
    https://github.com/VBA-tools/VBA-JSO...nConverter.bas
    Copy the whole code and put it in Stadard Module and name it "JSONConverter"

    Tool > References: Microsoft Scritpting Runtime

  6. #6
    Registered User
    Join Date
    06-11-2020
    Location
    Singapore
    MS-Off Ver
    2016
    Posts
    6

    Re: Error on VBA code for pull or extract data from HTML Element in Excel

    YasserKhalil, thank you very much for your quick reply!
    For the following link as given, i try to search the code but not really sure which code i should copy. Highly appreciate you can point out to me which code i need to refer and replace with which code in the current module code

  7. #7
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,882

    Re: Error on VBA code for pull or extract data from HTML Element in Excel

    Have a look at the attachment but you have to learn how to do such stuff by yourself
    Attached Files Attached Files

  8. #8
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: Error on VBA code for pull or extract data from HTML Element in Excel

    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ 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. How can i delete HTML element in vba excel ?
    By John_999 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-01-2020, 03:00 PM
  2. Import data from specific HTML element based URLs in a column
    By whatever61 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-04-2016, 08:04 AM
  3. Replies: 25
    Last Post: 06-10-2016, 10:17 AM
  4. Cannot find username element Id in fedex.com/us html code.
    By Locrian in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-27-2015, 02:53 PM
  5. NEED HELP: How to code correctly an HTML element to excel vba
    By blackorchids2002 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2015, 04:15 PM
  6. [SOLVED] Parsing HTML element into excel
    By chococ in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-11-2014, 05:20 PM
  7. Replies: 2
    Last Post: 05-18-2013, 02: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