I am trying to auto fill a form with information based on my excel document. I currently have get element by ID and fill in those forms correctly. The only trouble I am having is trying to click on “browse” files and then choosing a value from that and uploading said document.
Here is my code. I have the get document by ID correct, but is there a way to select a certain file through similar means? In the photo, I click the “browse” button and then click on the file I want to upload. I also tried to set the direct path in the macro but that didn’t seem to work out as well.
Sub GoToWebsiteTest() Dim appIE As InternetExplorerMedium 'Set appIE = Nothing Dim objElement As Object Dim objCollection As Object Set appIE = New InternetExplorerMedium sURL = "test.com" With appIE .navigate sURL .Visible = True End With Do While appIE.Busy Application.Wait DateAdd("s", 3, Now) Loop appIE.document.getElementById("tbSearchTerm").Value = "test" appIE.document.getElementById("ctl00_PlaceHolderMain_FileUpload_DocumentSelect").Value = "C:fakepathBook2.xlsm" Set appIE = Nothing End Sub