Forum

Save attachments fr...
 
Notifications
Clear all

Save attachments from IE to specified folder

6 Posts
2 Users
0 Reactions
82 Views
(@raj)
Posts: 21
Eminent Member
Topic starter
 

 

This is the html code for the button:

Download 36 Attachments

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... 


Sub AANs()
Dim Dates As Object, Matters As Object, i As Long,
Ws
As Worksheet
Dim L As Long
Lr 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 Order NUMBERS
For L = 2 To Lr1
Set Ws = ActiveWorkbook.Sheets("Sheet2")
Set ie = New InternetExplorer ie.navigate www.abc.com/sc/wo/index?id=" & _ ThisWorkbook.Sheets("Sheet1").Range("A" & L)
ie.Visible = True Application.Wait Now + TimeValue("00:00:05")
Set Html = New MSHTML.HTMLDocument
Html.body.innerHTML = ie.document.querySelectorAll(".btn btn-default")
Set Dates = Html.querySelectorAll(".wo-attachments-link") < 
GOT stuck here
Any Help please
 
Posted : 15/04/2020 6:13 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Rajsha,

Never done this with VBA, I have to wonder why you are using Excel to do this?  Doesn't seem the like the best tool.

You could try using Selenium https://www.myonlinetraininghub.com/web-scraping-filling-forms  

Then by clicking the download button the file will download. 

Driver.FindElementById("download-button-ID").Click

You may need to set some preferences in Chrome to save without asking you to save the file.

If you were to use Python it would be easier.

Regards

Phil

 
Posted : 15/04/2020 7:50 pm
(@raj)
Posts: 21
Eminent Member
Topic starter
 
Hi Philip Treacy, 
 
 I thought to reach you on this query, but i couldn't find the way to reach you. so i asked the query once. Last time you suggested me two sites which you posted. Those where help full but the think i'm struggling is we don't have access to "Selenium" or Python. That's the reason i'm trying to using VBA to get the result. And more over I don't have knowledge on this platforms which you suggested. Sorry for giving trouble. Thanks for your reply.
 
Rajsha
 
Posted : 16/04/2020 2:37 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Rajsha,

OK, not sure why you don't have access to Selenium or Python, they are both free.  As I'm not familiar with your environment or the restrictions on it I'm a bit stuck as to offer assistance.

Phil

 
Posted : 16/04/2020 3:32 am
(@raj)
Posts: 21
Eminent Member
Topic starter
 

Hi Philip,

I just what to know with you, how to send specific mail to you directly. Could you please let me know once if i want to check with you in regarding with this query back again. 

 

Thanks

Rajsha

 
Posted : 16/04/2020 9:54 am
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Rajsha,

You can contact me via this forum.

Regards

Phil

 
Posted : 16/04/2020 7:23 pm
Share: