+ Reply to Thread
Results 1 to 15 of 15

Open web page with VBA

  1. #1
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Open web page with VBA

    How do I open a web page with VBA

    Here is the web page.

    https://marketdata.theocc.com/stock-...eName=20200721

    The last digits will change daily representing yesterday's date (YYYYMMDD).

    I will use cell references to change the date.

    Any thoughts?

    Here is some code that i have so far...


    Please Login or Register  to view this content.

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Open web page with VBA

    I'm not sure how to prevent the file save prompt from coming up, perhaps someone else can help with that, but as far as just opening the page:

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Open web page with VBA

    Thank you for the quick response, maybe if it opens in Chrome instead...?

  4. #4
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Open web page with VBA

    I know chrome can be somewhat controlled via VBA (or at least used to) but it is not as easy as Internet Explorer. I've never actually done it, sorry.

  5. #5
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Open web page with VBA

    All good. Thanks for your help!

  6. #6
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Open web page with VBA

    Didn't need to mark as solved, I'm sure someone else would be able to help further, this is just not an area I'm very versed in. I do know that for Chrome you'd need to download and install something (Selenium-VBA) to be able to automate chrome.

    Sorry I wasn't more helpful, but thanks for the rep

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Open web page with VBA

    To download file something like below.

    Change fPath to suite your need.
    Please Login or Register  to view this content.
    Alternately you can use Get & Transform to directly query data without download.

    Ex: Create blank query, then go into query editor. View -> Advanced Editor. And paste below.
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  8. #8
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Open web page with VBA

    Nice CK Thanks for jumping in! I'd put it in the cavalry thread since I was afraid with responses already, it could get missed.

  9. #9
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,885

    Re: Open web page with VBA

    No problem

    This is pretty frequent request. I just had to change few things around on my standard code library.

  10. #10
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: Open web page with VBA

    This may be another alternative to dump the data from the CSV file located on the server, into the active sheet;

    Please Login or Register  to view this content.
    Last edited by Haluk; 07-22-2020 at 04:34 PM.

  11. #11
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Open web page with VBA

    Is there a way to choose only weekdays as dates?

    In the past I have used cell references.

  12. #12
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: Open web page with VBA

    For example ?

  13. #13
    Forum Contributor
    Join Date
    04-20-2020
    Location
    New Jersey, NJ
    MS-Off Ver
    MS Office 365
    Posts
    159

    Re: Open web page with VBA

    Here is the web page needed for today.

    https://marketdata.theocc.com/stock-...eName=20200807

    The last digits will change daily representing the last business day (YYYYMMDD).

    With the code I have been using, it gives me yesterday - 08/09/20.

    Please Login or Register  to view this content.

  14. #14
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: Open web page with VBA

    Try this;

    Copy and paste the following into a module and run the macro "Main"

    This macro will get the data related with the last Wednesday before today. For other weekdays; use vbMonday, vbTuesday,.....vbFriday


    Please Login or Register  to view this content.
    Last edited by Haluk; 08-10-2020 at 10:36 AM.

  15. #15
    Valued Forum Contributor Haluk's Avatar
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (22 H2) 64 Bit
    Posts
    1,150

    Re: Open web page with VBA

    And, if you want the macro to get the weekday from a cell, say E2 then use the macro "Main" as this;

    Note: Cell E2 will contain the weekdays Monday, Tuesday, Wednesday, Thursday or Friday.

    Please Login or Register  to view this content.
    Last edited by Haluk; 08-10-2020 at 10:39 AM.

+ 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. Launch Internet Explorer or Edge, open page, "Find on Page"
    By evanzo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-07-2019, 09:32 PM
  2. Replies: 4
    Last Post: 10-22-2019, 07:07 AM
  3. Open Recent Page - see more files/folders on page
    By ksmnff in forum Excel General
    Replies: 1
    Last Post: 09-04-2019, 01:09 PM
  4. Open Web Page with VBA
    By Curious56 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-27-2019, 02:50 PM
  5. Replies: 2
    Last Post: 11-11-2017, 07:40 AM
  6. Replies: 14
    Last Post: 08-17-2012, 10:54 AM
  7. when i open a excel doc , it open muiltple page not related?
    By greyshark001 in forum Excel General
    Replies: 1
    Last Post: 10-18-2005, 01:05 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