send key problem RRS feed

  • Question

  • I m using send key function to download excel file from website through IE7, i can use findwindows API to get the file download dialog box. But this is unable to do in IE9 because the dialog box replaced by ribbon. Hence, i failed to download when i using IE9. Any method that can use to get the ribbon. I couldn't get the hyperlink to download the file because it had already hidden, so it must use send key to click to download...
    Friday, October 19, 2012 4:35 PM

All replies

  • You do not have to use SendKey method to download file ;]

    The best way is API. A do not understand why your procedure cant work properly on IE9.

    Take look on this method:

    Public Declare Function URLDownloadToFile Lib "urlmon" Alias _
       "URLDownloadToFileA" (ByVal pCaller As Long, _
       ByVal szURL As String, _
       ByVal szFileName As String, _
       ByVal dwReserved As Long, _
       ByVal lpfnCB As Long) As Long
    Public Sub GURoL(url As String, FileName As String)
    Dim lngRetVal As Long
        lngRetVal = URLDownloadToFile(0, url, FileName, 0, 0)
        If lngRetVal <> 0 Then
        MsgBox "GURol godo: Can't download from " & url & " to " & FileName
        End If
    End Sub
    Sub Download_Procedure()
    Call GURoL("http://i.msdn.microsoft.com/ms348103.LOGO_WINDOWS(en-us,MSDN.10).png", _
               "c:\Temp\plik.png") '<change your dest. path
    End Sub

    Change web page and name of file right way.


    Oskar Shon, Office System MVP

    Press if Helpful; Answer when a problem solved

    • Proposed as answer by Asadulla JavedEditor Saturday, October 20, 2012 6:12 AM
    • Unproposed as answer by ckjason Saturday, October 20, 2012 6:43 AM
    Friday, October 19, 2012 9:55 PM