+ Reply to Thread
Results 1 to 17 of 17

VBA to get value frm website

  1. #1
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    386

    VBA to get value frm website

    Hi

    I am requesting a VBA to get vallue from
    https://dhan.co/etf/motilal-oswal-mi...f-share-price/
    by passing parameter MOM100 dhan.JPG

    I am using Excel 2016

  2. #2
    Valued Forum Contributor
    Join Date
    09-18-2023
    Location
    Geogia, USA
    MS-Off Ver
    365
    Posts
    331

    Re: VBA to get value frm website

    Do you know the exact URL for the stock you need a share price for or does that need to be calculated?

    If the sheet contained a table sort of like:
    Please Login or Register  to view this content.

    Okay here is some code that may help you.

    Please Login or Register  to view this content.
    You will need references to WinHTTP and HTML Object Library
    Attached Images Attached Images
    Attached Files Attached Files
    Last edited by jdelano; 05-21-2025 at 05:48 AM.

  3. #3
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    386

    Re: VBA to get value frm website

    If I change MOM to ACE it does not work

  4. #4
    Valued Forum Contributor
    Join Date
    09-18-2023
    Location
    Geogia, USA
    MS-Off Ver
    365
    Posts
    331

    Re: VBA to get value frm website

    Did you change the name and the symbol? it converts the name (with spaces) to the url needed.

  5. #5
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    386

    Re: VBA to get value frm website

    Yes I changed MOM and ACE it should work

  6. #6
    Valued Forum Contributor
    Join Date
    09-18-2023
    Location
    Geogia, USA
    MS-Off Ver
    365
    Posts
    331

    Re: VBA to get value frm website

    Post a screenshot of the data you put in the sheet, please.

  7. #7
    Registered User
    Join Date
    07-24-2023
    Location
    Oirschot, Netherlands
    MS-Off Ver
    2016
    Posts
    18

    Re: VBA to get value frm website

    I use a website daily where I have an account and retrieve various data from it after I am automatically logged in. I use the Chrome browser for this in combination with Excel-VBA and SeleniumBasic-2.0.9.0.
    All data can be read and sending username and password is also possible. If you are interested, I would like to help you.

  8. #8
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    386

    Re: VBA to get value frm website

    Attached, the URL changes for this symbol and each symbol i canot change URl , by passing symbol I should be able to get the value
    Attached Files Attached Files

  9. #9
    Valued Forum Contributor
    Join Date
    09-18-2023
    Location
    Geogia, USA
    MS-Off Ver
    365
    Posts
    331

    Re: VBA to get value frm website

    The style is different between the stock I tested with and the one you tried.

    Changed the function that does the retrieving
    Please Login or Register  to view this content.
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    386

    Re: VBA to get value frm website

    Hi
    well, this works but when I have huge data, it is impossible to copy URL and paste for every line. Is it possible that I have only Column B and C and I input symbol in Column B to get data in Column C without any URL or name

  11. #11
    Valued Forum Contributor
    Join Date
    09-18-2023
    Location
    Geogia, USA
    MS-Off Ver
    365
    Posts
    331

    Re: VBA to get value frm website

    You'll see in the comments that it can calc using the name

  12. #12
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    386

    Re: VBA to get value frm website

    Can you please help me modifty to this URL
    Bevause in this the URL does not change I have to only pass param MOM100

    https://www.nseindia.com/get-quotes/...?symbol=MOM100

  13. #13
    Valued Forum Contributor
    Join Date
    09-18-2023
    Location
    Geogia, USA
    MS-Off Ver
    365
    Posts
    331

    Re: VBA to get value frm website

    Then you'd do something like this

    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    386

    Re: VBA to get value frm website

    I have made changes but it does not work
    Attached Files Attached Files

  15. #15
    Valued Forum Contributor
    Join Date
    09-18-2023
    Location
    Geogia, USA
    MS-Off Ver
    365
    Posts
    331

    Re: VBA to get value frm website

    I don't have access to that link.
    "Access Denied
    You don't have permission to access "http://www.nseindia.com/get-quotes/equity?" on this server.
    Reference #18.b20a3517.1748865148.29e0901

    https://errors.edgesuite.net/18.b20a3517.1748865148.29e0901"

    Go to the link https://www.nseindia.com/get-quotes/equity?symbol=ACE and then right click the page and select view source. Then find the HTML element names or styling that identifies where in the page the information you're interested in. It may be that the HTML layout for this URL is different from the first one you were attempting to use.

  16. #16
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    386

    Re: VBA to get value frm website

    it is div.blkbox.whitetxt

  17. #17
    Forum Contributor
    Join Date
    11-10-2019
    Location
    India
    MS-Off Ver
    2013
    Posts
    386

    Re: VBA to get value frm website

    <div class="blkbox-whitetxt">
    <span id="quoteLtp" data-nse-translate="number" class="pe-2">1,259.30</span>
    <span id="arrowInfoStatus" class="blkbox-greentxt" aria-label="quote value High">
    <span class="rg-arrow"><span class="invisibleText">quote value High</span></span>
    </span>
    </div>

+ 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. Replies: 4
    Last Post: 02-27-2022, 11:30 PM
  2. Automate website login where the website only allows manual input of username/PW
    By whiterabbit in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-25-2018, 12:00 PM
  3. Website Script to click button on Website and export file to directory?
    By stangz71 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-27-2017, 03:55 PM
  4. website scrapiplping to get data from multiplepages of website
    By mpatil in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-17-2015, 05:00 AM
  5. Averageif WILDCARD for website.com AND EXCLUDE website.com.xx
    By Gerhard.Angeles in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-14-2014, 09:12 AM
  6. Opening website, getting data, closing website
    By beta_leonis in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-27-2012, 03:50 AM
  7. HYPERLINK("website/"Cell.Text"website, A4)
    By keepstar in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-17-2010, 05:17 PM

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