+ Reply to Thread
Results 1 to 5 of 5

How to download PNC document from web page

  1. #1
    Registered User
    Join Date
    09-22-2011
    Location
    Italy
    MS-Off Ver
    Office 2019 (Windows 11 Pro)
    Posts
    47

    How to download PNC document from web page

    Happy New Year to all,
    Can someone help me on how to download a Pnc document from a Consob web page that worked until last year and is no longer working.
    The previous statement was:

    Please Login or Register  to view this content.
    The download page is here: https://www.consob.it/web/area-pubblica/pnc > PNC su titoli azionari, aggiornate e storiche
    Thanks for any help!
    Last edited by alpha45; 01-23-2023 at 12:19 PM.

  2. #2
    Valued Forum Contributor
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (24 H2) 64 Bit
    Posts
    1,187

    Re: How to download PNC document from web page

    Try this;

    Please Login or Register  to view this content.
    Last edited by Haluk; 01-23-2023 at 01:25 PM.

  3. #3
    Registered User
    Join Date
    09-22-2011
    Location
    Italy
    MS-Off Ver
    Office 2019 (Windows 11 Pro)
    Posts
    47

    Re: How to download PNC document from web page

    Thanks for the reply,
    The url as you modified it works, but it downloads the file in folder download, while correct it should download it and open it in Desktop.
    Kindly can you direct me where to add your code to avoid malfunction?
    Thank you for now...
    Hello

    [CODE]'Questa parte va RIGOROSAMENTE in testa al Modulo vba:By Piero Tamagni-16/01/2019 mod.06/03/2019
    Private Declare PtrSafe 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
    Sub UpdateData()
    Application.ScreenUpdating = False
    Sheets("SHORT").Unprotect
    Dim z, DOdi, Tr, i, l, valore, stringa, DOdix
    Dim rngUniques As Range, rng As Range, nome As Range, foundNome As Range, total As Double
    Dim fVisRow As Long, lVisRow As Long, lCol As Long, LastRow As Long, ColLetter As String
    Dim desWB As Workbook, srcWs As Worksheet, desWS As Worksheet, wk As Workbook
    Set desWB = ThisWorkbook
    Set desWS = ThisWorkbook.Sheets("SHORT")
    Set WShell = CreateObject("WScript.Shell")
    Call Clear_Temp_Files
    mydPath = WShell.SpecialFolders("Desktop")

    'Resp = URLDownloadToFile(0, "https://www.consob.it/documents/46180/46181/PncPubbl.xlsx/ddc5b7dc-b8a5-4d6c-aff5-0ce15e4109a9?l=" & Int(Rnd() * 1000000), mydPath & "\Pnc-" & Format(Now, "yyyy-mm-dd") & ".xlsx", 0, 0)
    'Resp = URLDownloadToFile(0, "https://www.consob.it/documents/46180/46181/PncPubbl.xlsx/ddc5b7dc-b8a5-4d6c-aff5-0ce15e4109a9?l='+rand", mydPath & "\Pnc-" & Format(Now, "yyyy-mm-dd") & ".xlsx", 0, 0)

    Set WShell = Nothing
    Workbooks.Open (CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\Pnc-" & Format(Now, "yyyy-mm-dd") & ".xlsx")
    Set wk = Workbooks.Open(CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\Pnc-" & Format(Now, "yyyy-mm-dd") & ".xlsx")
    Set DOdi = Sheets(" Pubb. Data - Pubb. Date ").Range("A3") ' conversione formato data /a -.
    Application.Windows(wk.Name).Visible = False
    If DOdi = Format(desWS.Range("B1")) Then z = MsgBox(" The update date is the same, do you want to continue?", vbYesNo, " Aggiornamento dati")
    z = Val(z)
    ....
    Last edited by alpha45; 01-24-2023 at 10:33 AM.

  4. #4
    Valued Forum Contributor
    Join Date
    02-14-2019
    Location
    Turkiye
    MS-Off Ver
    2010 - 64 Bit on Windows-11 (24 H2) 64 Bit
    Posts
    1,187

    Re: How to download PNC document from web page

    The file is downloaded into the folder where the Excel file which houses the macro code.

    So, if you run the code when the file is on your desktop, it downloads the Pnc document to your desktop. If you wish, you can modify the variable "myfile" for this purpose.

  5. #5
    Registered User
    Join Date
    09-22-2011
    Location
    Italy
    MS-Off Ver
    Office 2019 (Windows 11 Pro)
    Posts
    47

    Re: How to download PNC document from web page

    @Haluk
    Thank you!
    Last edited by alpha45; 01-24-2023 at 10:37 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. Download CSV from Web Page
    By chisox721 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2017, 05:20 AM
  2. Macro to Download attachements on a page
    By imogul in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-04-2013, 03:44 PM
  3. Add-ins Resource Page
    By ktennies in forum Suggestions for Improvement
    Replies: 0
    Last Post: 07-25-2013, 01:34 PM
  4. [SOLVED] Having difficultly moving a section from page 3 to page 2 in a word document form
    By UNAB in forum Word Formatting & General
    Replies: 2
    Last Post: 03-25-2013, 07:52 AM
  5. download all links within an excel document
    By space108th in forum Excel General
    Replies: 5
    Last Post: 08-20-2012, 06:58 AM
  6. Download XML Page Source
    By prescient in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-04-2010, 12:23 AM
  7. [SOLVED] How do I delete page 2 of a 2-page document?
    By Katie in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 06-14-2006, 12:00 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