none
Simple addon to download pdfs automatically RRS feed

  • Question

  • I am looking to have PDF files download automatically in IE, at least from a specific site. I am looking for any solutions to do this, and perhaps a plugin would work. That is, following https://jwcooney.com/2014/03/31/remove-internet-explorer-open-or-save-popup/ i can save a file once in IE, and have it not ask on following downloads. So, the idea would be to have a very simple addon that would simply download the file for me.

    Does that make sense? Is there such an addon? I see a download manager in the Windows store, but it explains that you need to paste the URL into it, which is not an option here. I want a simple addon that just downloads the PDF when IE loads it.

    Friday, August 23, 2019 12:14 AM

All replies

  • Hi Brian Tkatch,

    I am not aware about any add in which can automatically download the files in IE.

    I suggest you to use VBA IE automation using Excel may help you to solve your issue.

    You can refer the example below may help to download any PDF file from specific site using IE.

    Private 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
    
    Function DownloadFile(url As String, LocalFilename As String) As Boolean
        Dim lngRetVal As Long
        lngRetVal = URLDownloadToFile(0, url, LocalFilename, 0, 0)
        If lngRetVal = 0 Then DownloadFile = True
    End Function
    
    Sub DownloadPDF()
    Dim strPDFLink As String
    Dim strPDFFile As String
    Dim doc, hcol, text As Variant
    Dim ie As SHDocVw.InternetExplorer
    Set ie = CreateObject("InternetExplorer.Application")
    
       MsgBox "Select Folder to Save .pdf to)"
    Dim FolderName As String
    With Application.FileDialog(msoFileDialogFolderPicker)
       .AllowMultiSelect = False
       .Show
    
       On Error Resume Next
       strDir = .SelectedItems(1)
       Err.Clear
       On Error GoTo 0
     End With
    
        strPDFLink = "https://www.vba-market.com/DownloadPDF_fromURL.pdf"
        strPDFFile = strDir & "\DownloadPDF_fromURL_" & Format(Now, "yyyy.mm.dd") & ".pdf"
        ie.Visible = True
        ie.Navigate (strPDFLink)
        Application.Wait (Now + #12:00:02 AM#)
        Result = DownloadFile(strPDFLink, strPDFFile)
    
    End Sub

    Reference:

    Macro that downloads pdf file to designated folder from URL

    To perform this task automatically, you need to call this macro on any event which get executed while Excel file get opened.

    You can use Windows Task Scheduler to open this file on any specific time.

    Further, you can try to modify the macro based on your requirement.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 23, 2019 2:42 AM
    Moderator
  • The PDF file cannot seem to be gotten to directly. I must click a button, then it downloads. I have a VB program using the WebBrowser object getting most of that done.

    I am currently trying to get another program to run (a batch file, or a simple vb program) to accept the pdf location on disk as a parameter and simply copy it to where i'd like it to go. I would think a plugin would be simpler though, not sure.

    Thank you for taking a look.

    Friday, August 23, 2019 4:23 AM
  • Hi Brian Tkatch,

    Not sure about any ready made plugin but you can try to store your location path in Excel sheet and pass it as a parameter to the VBA code.

    Let us know, how we can help you further on this issue.

    Thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, August 23, 2019 6:19 AM
    Moderator