Upload a file to a web page with VBA

Juan Fonseca

New Member
Joined
Apr 4, 2021
Messages
3
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Platform
  1. Windows
  2. Web
Best regards to everyone, I am trying to automate the process of uploading some documents to a web platform.

I already know how to click on the "browse" button that appears on the page to upload the files knowing its ID (I use IE.document.getElementById ("Browse_Button"). Click), but here a window opens to search and select the file to upload; and it is at this point where I do not know how to automate the search for the document (I already have the path saved in a string filepath) within the window that opens and finally click on the "upload file" button of said window.


I appreciate you could help me with the part of the code and / or the explanation of the commands to manage it within this search window.
1617557341481.png
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

John_w

MrExcel MVP
Joined
Oct 15, 2007
Messages
6,891
You can upload a file using VBA by automating the web page's HTML form with IE:


Look in the HTML for the form with an input tag of type=file to determine the field name you must specify in the Content-Disposition header.
 

Forum statistics

Threads
1,136,274
Messages
5,674,772
Members
419,525
Latest member
helensesc

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top