PDA

View Full Version : IE WEBSITE FILE UPLOAD



mji
05-23-2016, 03:47 AM
Dear All,

VBA code for https://imgsafe.org/ to click +browsefile button then auto add file with location i.e. 'C:\Image.jpg' and press Open button after it select upload button for uploading image and copy and paste image name i.e. "https://i.imgsafe.org/95646ec.jpg" in excel cell.

Regards.

MJI

Jacob Hilderbrand
05-23-2016, 08:26 AM
Can you clarify the issue you are having?

mji
05-25-2016, 02:54 AM
Can you clarify the issue you are having?

1.VBA to open https://imgsafe.org and press Browsefile button as per following picture highlighted
16251
2.After above vba to put file name with location for uploading and press OPEN button as per next image
16252
3.After 2nd step vba click UPLOAD button as per picture highlighted
16253

4.Then 3rd step vba paste image link in excel sheet1 A1 cell as per following picture
16254


Regards
MJI

mji
05-25-2016, 03:27 AM
I done 1st step and also can done 3rd step through last codes


Sub imagesafe()
Dim ie As Object
Dim tags As Object
Dim tagx As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.navigate "https://imgsafe.org/"
ie.Visible = True
Do While ie.Busy And Not ie.readyState = 4
DoEvents
Loop
Do While ie.Busy And Not ie.readyState = 4
DoEvents
Loop
Application.Wait (Now + TimeValue("00:00:05"))
Set elementcol = ie.document.getelementsbytagname("input")
For Each btninput In elementcol
If btninput.getattribute("id") = "fileupload" Then
btninput.Click
End If
Next btninput
End Sub


need to know how done 2nd and 4 step

mji
05-25-2016, 08:05 AM
ADDED FOLLOWING BUT NOT WORKED



Application.Wait (Now + TimeValue("00:00:05"))
Set ElementCol = ie.Document.getElementsbytagname("input")
For Each btnInput In ElementCol
If btnInput.getattribute("name") = "files[]" Then
btnInput.Value = "C:\Users\abc\Desktop\Safari\Africa-Tanzania-Migration-1-sunset.jpg"
btnInput.FireEvent ("onclick")
End If
Next btnInput

Jacob Hilderbrand
05-26-2016, 08:00 AM
Ok at this point does the image download? Once it is downloaded you could have the macro insert the image from your computer.

Aussiebear
05-26-2016, 05:33 PM
Any reason why the lines


Do While ie.Busy And Not ie.readyState = 4
DoEvents
Loop

Are duplicated?

mji
05-26-2016, 10:50 PM
Dear Jacob,

In post No.3 available in STEP WISE

and i need to how macro perform step 2 and 4



Regards.

mji
05-26-2016, 10:50 PM
sorry mistaken

mji
05-29-2016, 10:45 PM
no solution ?