Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How Use VBA to upload attach file to webform in Internet explorer 1

Status
Not open for further replies.

GPnew

Programmer
Nov 12, 2001
56
NZ
I am populating a webform on internet explorer using vba

I have succeeded in doing so with textboz, check box and drop down selections HOWEVER I cannot get the code to upload a file

As below I am successfully using getElementbyId to identify the field to populate the form

doc.getElementbyId("f1_receiver_contact_name").Value = strCustomer
doc.getElementbyId("f1_cost_value").Value = iValue
doc.getElementbyId("f1_type_of_claim").Value = strType
doc.getElementbyId("f1_over50dollars_yes").click

However I cannot upload a pdf file (full) directoty path is strAttach

The field into which the file is stored has the elementid "f1_supporting_document"
I have tried the following
doc.getElementbyId("f1_supporting_document").value = strAttach
and
doc.getElementbyId("f1_supporting_document").document = strAttach

but neither works
When uploading manually I click on a browse buttom and then select the filepath
Perhaps my code is missing something to reflect that action ?
Any ideas ?
Greg P
 
Thanks for looking at this

I assumed it should be described as VBA as I am running the code in the back of an EXcel spreadsheet to populate a webform ?

The detail attached to the field to which I am trying to automate the upload is as follow

<input type="file" name="supporting_documents" accept=".xls,.xlsx,.doc,.docx,.pdf,.jpg,.jpeg,.gif,.zip,.png,.txt" id="f1_supporting_document" class="required ignore"/>

Hope that helps
 
Hi Greg,

Can you please provide a data flow so that it's clear what you are trying to do?

For example:

Pulling info from cells A1, B3, and C4
Using values to determine file name and folder pathway
Exporting Sheet as PDF to folder pathway and saving it with the file name
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top