سلام
چطور میشه کل فایل های اکسل سایت کدال رو از طریق اکسل دانلود کرد؟
چطور میشه کل فایل های اکسل سایت کدال رو از طریق اکسل دانلود کرد؟
'API function declaration for both 32 and 64bit Excel. #If VBA7 Then 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 #Else 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 #End If Sub DownloadFiles() Dim el As IHTMLElement Dim allRowofData As IHTMLElementCollection Dim appIE As Object Set appIE = CreateObject("internetexplorer.application") Namad = "مفاخر" Start_page = 1 End_page = 3 For pgn = Start_page To End_page With appIE .Navigate "https://www.codal.ir/ReportList.aspx?search&Symbol=" _ + Namad + "&LetterType=-1&AuditorRef=-1&PageNumber=" + Str(pgn) _ + "&Audited&NotAudited&IsNotAudited=false&Childs&Mains&Publisher=false&CompanyState=-1&Category=-1&CompanyType=-1&Consolidatable&NotConsolidatable" .Visible = False End With Do While appIE.Busy DoEvents Loop Application.Wait (Now + TimeValue("00:00:02")) Set allRowofData = appIE.Document.getElementsByClassName("icon icon-excel ng-scope") dlpath = ThisWorkbook.Path + "\file-" i = 1 For Each el In allRowofData Downlink = el.getAttribute("href") URLDownloadToFile 0, Downlink, dlpath & Str(i) & ".xls", 0, 0 i = i + 1 Next Next appIE.Quit Set appIE = Nothing End Sub
کامنت