I need help with clicking a button using vba to download the files, Here are the steps what I'm trying to do:
Log in web site: (due to restriction i cant provide site details.)
download attachments from the "download attachments" button
Save the files(all files - any format) to specified path with folder name as provided in Sheet1 of "A" column
This is the html code for the button:
All the attachments should be downloaded to specific folder with Order number as a folder name. Order numbers are listed in Column A of the Sheet1 (based on Order number we ill search the results)
I found this piece of code...
Any Help please.. Thanks
Log in web site: (due to restriction i cant provide site details.)
download attachments from the "download attachments" button
Save the files(all files - any format) to specified path with folder name as provided in Sheet1 of "A" column
This is the html code for the button:
HTML:
<a class="btn btn-default" href="#" data-bind="click : downloadAttachments, visible: $root.attachmentsViewModel.attachments().length > 0">
<i class="fa fa-download js-app-action-el" aria-hidden="true"></i>
Download <strong data-bind="text:$root.attachmentsViewModel.attachments().length">36</strong> Attachments
</a>
All the attachments should be downloaded to specific folder with Order number as a folder name. Order numbers are listed in Column A of the Sheet1 (based on Order number we ill search the results)
I found this piece of code...
VBA Code:
Dim Dates As Object, Matters As Object, i As Long, Ws As Worksheet
Dim L As Long
Dim Html As MSHTML.HTMLDocument
Lr1 = ThisWorkbook.Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
Dim ie As New InternetExplorer
'SETTING IE FOR WORKORDERS
For L = 2 To Lr1
Set Ws = ActiveWorkbook.Sheets("Sheet2")
Set ie = New InternetExplorer
ie.navigate "https://www.abc.com/sc/wo/Work/index?id=" & _
ThisWorkbook.Sheets("Sheet1").Range("A" & L)
ie.Visible = True
Application.Wait Now + TimeValue("00:00:10")
Set Html = New MSHTML.HTMLDocument
Set Ws = ThisWorkbook.Worksheets("Sheet2")
Html.body.innerHTML = ie.document.querySelectorAll("..btn btn-default").Item(1).outerHTML 'Got stuck here
Any Help please.. Thanks