+ Reply to Thread
Results 1 to 7 of 7

Navigating/Downloading Chrome using VBA

  1. #1
    Registered User
    Join Date
    04-14-2014
    Location
    Cape Town
    MS-Off Ver
    Excel 2010
    Posts
    6

    Unhappy Navigating/Downloading Chrome using VBA

    Hi All

    Hope you are well and can help me out here. Its something so simple yet I am struggling so much.
    I am using chrome. I have got my code to open the below hyper-link.

    https://www.jse.co.za/downloadable-f...ives/Docs_DMTM

    The problem now is that I cant select the top/latest excel file.

    Eg: "yyyyMMdd_D_Daily MTM Report.xls"

    If you could help with coding that will select this file and download it and open the file it would be much appreciated.


    Regards
    T

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Navigating/Downloading Chrome using VBA

    You can't without external commercial software - you can with Internet Explorer though

    Though you don't need to use IE or Chrome just to open an Excel file from the internet
    Last edited by Kyle123; 08-06-2014 at 09:38 AM.

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

    Lightbulb Re: Navigating/Downloading Chrome using VBA


    Hi,

    you can drive either Chrome, Firefox or IE (and a Phantom mode !)
    by using the webdriver wrapper Selenium V2 …

    For this easy kind of stuff, you can do it directly in VBA by piloting IE or using a request library.

    But where is your code ?‼
    Last edited by Marc L; 08-06-2014 at 02:39 PM.

  4. #4
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Navigating/Downloading Chrome using VBA

    Pretty sure a workbooks.open would suffice

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

    Thumbs up Re: Navigating/Downloading Chrome using VBA


    I agree, maybe with ReadOnly set to True

  6. #6
    Registered User
    Join Date
    04-14-2014
    Location
    Cape Town
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Navigating/Downloading Chrome using VBA

    Hi guys

    Solved it with the below code...


    Sub YieldX_Data()

    Dim myURL As String
    Dim The_Address As String
    Dim oDate As Long
    Dim TheFile As String
    Dim Location As String

    oDate = Format(Worksheets("Dates").Range("I4").Value, "yyyyMMdd")

    The_Address = Worksheets("Dates").Range("H10").Value

    Location = "M:\Safex & YieldX\Daily Statements\YieldX\YieldX Data"

    TheFile = Location & " " & oDate & ".xls"

    myURL = The_Address

    Dim WinHttpReq As Object
    Set WinHttpReq = CreateObject("Microsoft.XMLHTTP")
    WinHttpReq.Open "GET", myURL, False
    WinHttpReq.Send

    myURL = WinHttpReq.ResponseBody

    If WinHttpReq.Status = 200 Then

    Set oStream = CreateObject("ADODB.Stream")
    oStream.Open
    oStream.Type = 1
    oStream.Write WinHttpReq.ResponseBody

    If Dir(TheFile) <> "" Then
    MsgBox "File already exists!"
    Else
    oStream.SaveToFile (Location & " " & oDate & ".xls")
    End If

    oStream.Close


    Thanks

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

    Lightbulb Re: Navigating/Downloading Chrome using VBA


    Hi,

    according to forum rules, you must use code tags ! …


    Example to directly open top/latest excel file :

    Please Login or Register  to view this content.
    If you like, don't forget to click on bottom left star Add Reputation !

+ 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. Copying from Chrome tab
    By patzkata in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-15-2014, 10:14 AM
  2. Macro to navigate google chrome
    By Captainplanet in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-05-2012, 09:25 AM
  3. Navigating a web browser (Firefox, IE or google chrome) through VBA
    By JimmySmith in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-08-2012, 05:35 AM
  4. Launch Chrome from within Excel on a MAC?
    By ChainsawDR in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-21-2012, 01:48 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