shahin
Active Member
After going through this post https://stackoverflow.com/questions/60944569/unable-to-upload-a-text-file-using-vba, I thought to create a vba script capable of uploading a pdf file in a website. When I try the script below, I could notice that the script does upload the file if I choose yes when a pop up window shows up. I know this is probably not the way I should go on with. However, I could only think of this way at this moment.
This https://filebin.net/qvpwjwl85oonmya2 is where you can download the pdf file if needed.
This is the site link https://www.file.io/ for your consideration.
How can I upload a pdf file using vba?
This https://filebin.net/qvpwjwl85oonmya2 is where you can download the pdf file if needed.
This is the site link https://www.file.io/ for your consideration.
Code:
Sub UploadFile()
Dim Http As New XMLHTTP60, sPostData$
Dim wbO As Workbook
Set wbO = Workbooks.Open("C:\Users\WCS\Desktop\TEST.pdf")
sPostData = wbO.Sheets(1).Cells.Copy
wbO.Close SaveChanges:=False
With Http
.Open "POST", "https://file.io"
.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
.send ("text=" & sPostData)
Debug.Print .responseText
End With
End Sub
How can I upload a pdf file using vba?
Last edited: