Consulting

Results 1 to 5 of 5

Thread: Get live changes of a number on a webpage

  1. #1

    Get live changes of a number on a webpage

    Dears,

    I hope each and every one of you is having a good day

    So what I'm trying to do is: There is a webpage that has some numbers that are continuously changing, I want a cell of my excel sheet to get live updates of one of the numbers on the webpage.

    What I have so far: I wrote a VBA code (First time VBA, kind of expert in Java), that gets the number and sets it inside the active cell without any problem. But, what I want it to do is keep getting live updates of the number on the webpage.

    What I tried to get live updates: I tried to use an infinite loop but it makes my Excel window unresponsive. I also tried Application.OnTime but I failed to find-out how to pass a parameter to it

    Here's my excel file, you can see the VBA code: Book1.xlsm

    Any help is appreciated
    Best regards

  2. #2
    VBAX Regular
    Joined
    Mar 2018
    Posts
    10
    Location
    Here's my excel file, you can see the VBA code: Book1.xlsm

    Any help is appreciated
    Best regards[/QUOTE]

    Hi. If that's the data that you want, and that's the website that you want to get it from, then I'd recommend skipping VBA/IE altogether and just letting Excel handle it for you through a simple data query (Data Tab -> Get Data -> Get Data from Web). This will source the data for you and deposit it onto a spreadsheet as per the picture below. It also runs continuous updates of the data for you.
    It's a lot quicker and more efficient than using VBA to resurrect additional instances of IE every two seconds to go find out the data for you!!

    Separately, as regards your code, you were on the right track with your Application.Ontime approach, and with the parameters you were using, except for two points:

    Application.OnTime Now + TimeValue("00:00:02"), "'RunEveryOneSecond " & IE & "'"
    Here, you were trying to concatenate a string with an object (IE) and this was never going to work.

    I wrote a much longer post setting out my comments, and attaching a screen capture, but the system rejected it and deleted all my text in the post. Having lost my sense of humour with this system, and needing to go to sleep, I'll have to leave it here, in hopes that one of the admins (benevolently) permits me to post this on the site. Let me know if you need any help with the above and I will try again tomorrow.

  3. #3
    Hello DanWall,

    I appreciate you replying to my question.

    The reason why I didn't use the data query method is because it doesn't even work with that website, the reason why is the data that I'm trying to get is not inside a table so the web query method does not detect it.

    As regards my code, you did tell me why my code was not going to work, but you didn't tell me what are the changes that I need to do to get it to work.

    Best regards.

  4. #4
    VBAX Regular
    Joined
    Mar 2018
    Posts
    10
    Location
    Quote Originally Posted by MiRaN1337 View Post
    Hello DanWall,<br>
    <br>
    I appreciate you replying to my question.<br>
    <br>
    The reason why I didn't use the data query method is because it doesn't even work with that website, the reason why is the data that I'm trying to get is not inside a table so the web query method does not detect it.<br>
    <br>
    As regards my code, you did tell me why my code was not going to work, but you didn't tell me what are the changes that I need to do to get it to work.<br>
    <br>
    Best regards.
    <br>Hi. Apologies for the very belated response - I thought I had replied to this, but I guess not. From memory, I tried to post the info again on Xmas day, but couldn't - and I guess it slipped my mind afterwards. Looking at it again just now, I suspect I didn't want to spend too much time on it because it is accessible through the data query method. I remember checking it then, and I've just checked it again now - it's there. Using the data query method, it returns three tables (Table 0, 1 and 2). The particular information you want is identifiable from the class name in your code - which is precisely the same data point as that which is contained in Table 0. I am looking at it refresh on my spreadsheet right now. You probably don't need it anymore, but let me know if you do.

    AND I just tried to send the screen captures again, and it won't keeps on telling me I can't send URLs (I'm not) - I'm sick of it. Look, it's doable - I've done four times.

  5. #5
    Quote Originally Posted by DanWall View Post
    <br>Hi. Apologies for the very belated response - I thought I had replied to this, but I guess not. From memory, I tried to post the info again on Xmas day, but couldn't - and I guess it slipped my mind afterwards. Looking at it again just now, I suspect I didn't want to spend too much time on it because it is accessible through the data query method. I remember checking it then, and I've just checked it again now - it's there. Using the data query method, it returns three tables (Table 0, 1 and 2). The particular information you want is identifiable from the class name in your code - which is precisely the same data point as that which is contained in Table 0. I am looking at it refresh on my spreadsheet right now. You probably don't need it anymore, but let me know if you do.

    AND I just tried to send the screen captures again, and it won't keeps on telling me I can't send URLs (I'm not) - I'm sick of it. Look, it's doable - I've done four times.
    No problem brother, you still replied so it is not a big deal, I would love to know how did you do it, you can PM me if you want

    Best regards

Tags for this Thread

Posting Permissions

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