Consulting

Results 1 to 3 of 3

Thread: Download File from Website From Excel

  1. #1
    VBAX Regular
    Joined
    May 2017
    Posts
    19
    Location

    Download File from Website From Excel

    Hi,

    I know some basic VBA for working with data within Excerl but very little HTML.

    I can successfully open a website/link from website from Excel using chrome browser via:

    Sub Chrome_Test()


    'Loads Page
    Dim WebUrl As String
    '
    WebUrl = "https://analytics.***xx.******.com/#/metrics?interval=r&datesel=d30&zoom=day&measure=units&type=line&app=9717031 12"
    End sub

    where is ***xx is part of the website name (the site also requires Username and password to access but I have got chrome to remember it)


    On the page there is a download button that downloads a CSV file when clicking on it. I would like to hit the download button or do the eqv to download the CSV file on local machine using the VBA code in Excel.

    I have used the "inspect" command to view the page. And the following HTML code seems to relate to the download button:

    <div ng-click="getData()" class="icon cicon-download"></div>

    Does anyone know how I would execute this line in VBA?

    Alternatively as a fall back option I could use send keys. In this case does anyone know what combination of keys would mimic clicking left mouse button? Ctrl D does not work.

    Many thanks

    Whisky

  2. #2
    VBAX Expert
    Joined
    May 2016
    Posts
    604
    Location
    Hi Whisky, welcome to the forum,
    Unfortunately downloading information from websites is not that easy since every website is different.
    Have a look at this thread which goes through a couple of ways of doing it but doesn't deal with the username and password problem, but it might get you started.
    http://www.vbaexpress.com/forum/show...tes&highlight=

  3. #3

Posting Permissions

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