I am trying to upload all the files in a folder to a web portal (all files are PDFs of invoices) using VBA. I have the code sorted to enter usernmae and password sorted and then click "Login" button. That opens to a new page to where files are to be uploaded, the default method is "Drag & Drop".
This is the code I have so far
Sub InvToBkpr()
Dim sFormData As String, d As String, ie As Object
Dim sPath$, sFile$
sPath = ThisWorkbook.Path & "\Boekhouder_PDF\"
Const URL$ = "https://portal.pecco.be/Account/Login/"
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Navigate URL
.Visible = True
Do Until Not .Busy And .readyState = 4
DoEvents
Loop
.document.getElementByID("UserName").Value = [PtlUn]
.document.getElementsByName("Password")(0).Value = [PtlPwd]
.document.forms(0).Submit
Do Until Not .Busy And .readyState = 4
DoEvents
Loop
'Code above works fine to open Outlook, insert username & password then login
'PtlUn and PtlPwd are named ranges in my workbook containing the necessary usernmae and password
'Code below is where I need to upload all the files from folder to website
sFile = Dir(sPath)
Do While Len(sFile)>0
'??????
'??????
sFile = Dir
Loop
End With
End Sub
This is a screen shot of the Upload page which opens after successful login, files need to be uploaded to the "Sales" section, as far as I can make out the ID for that element is "fileuploaderSales".
I have tried to modify the answer to this
But without success.
Any help greatly appreciated. TIA