PDA

View Full Version : Copy and paste multiple data from Excel to Internet Explorer



Emem27
02-18-2017, 09:54 AM
Hi!
I am just new in VBA and I just learn it online via youtube or via google. I would like to ask help to automate a task where I copy information in Excel and paste it in Internet Explorer. I usually have 3K items in excel that I need to put in internet explorer and it is taking a lot of time to do this manually.

I have googled and only manages to get how to open IE and the data VBA code used is pointing to one cell only while I need to make a loop since I need to enter many data after the other.

Example:
Name Gender Age
Shayne Female 33
Anna Female 20

I need to put that in the IE and after I input the Age, I need to click "Submit" so I could enter the next line (Anna's data) and so on and so forth.

Hope someone could help.

werafa
02-19-2017, 02:42 AM
don't be ashamed of being new - or of asking annoying questions.

try this link http://www.makeuseof.com/tag/using-vba-to-automate-internet-explorer-sessions-from-an-excel-spreadsheet/
and please let us know how you get on. this is a new one for me, and I am curious to learn how you go.

thanks
Werafa

Emem27
02-19-2017, 07:13 AM
Hi Werafa,

Thanks for the reply and apologies as I may have confused you. The link provided is on automating openning multiple IE sessions. While my problem is on submitting data in IE.

Like in the example above, I will go to the Internet and put the Name and Age one after the other and submit each time I am done in putting the name and age of one person.

p45cal
02-19-2017, 07:23 AM
I doubt many people will know the answer to this, especially as techniques required are probably heavily dependent upon the website concerned. So this will need some development/experiment.
Can you give us that website url?

werafa
02-19-2017, 07:17 PM
There is little confusion, but much lack of knowledge. That must make me an expert :)

thoughts that may help:
- to manipulate object properties, such as form fields, an object with the appropriate properties must exist.
- Find the name of the correct object, and you are half way there.
- https://msdn.microsoft.com/en-us/library/ms970456.aspx is quite old, but may give you a head start with some naming conventions

as an alternative, there are programs out there that are used to write 'screen scrapers'. these pretend to be a human operator, and can 'click' on buttons, as well as enter data into fields. my last employer used these to enter numbers from a huge list into a data entry form, and record the resulting data page.

werafa

simora
02-21-2017, 03:57 AM
Are you thinking about something along these lines ?

https://social.msdn.microsoft.com/Search/en-US?query=fill%20in%20website%20form%20thru%20vba&pgArea=header&emptyWatermark=true&ac=5#refinementChanges=&pageNumber=2&showMore=false

OR

https://www.google.com/search?q=excel+vba+to+fill+in+a+web+form&ie=utf-8&oe=utf-8

werafa
02-22-2017, 01:40 PM
more like http://webscraper.io
or https://chrome.google.com/webstore/detail/screenscraper/pfegffhjcgkneoemnlniggnhkfioidjg?hl=en

Whilst these are primarily about data capture, at least some allow database driven data entry.

but....

going back to your original question, you can open IE, and get data from one cell.
can you place it in the IE form?

you will need something like (i'm paraphrasing the code)

" Do while myRow has data
var1 = mySheet.range(name)
var2 = mySheet.range(gender)
var3 = mySheet.range(age)

ie.page.object(field1) = var1
ie.page.object(field2) = var2
ie.page.object(field3) = var3

ie.page.object(the submit button) = true

next myRow"

This should give you the looping structure, and read the data from excel (you will still need to translate this into actual VBA code)
unfortunately, I don't know the names of the relevant IE page objects, so you will still need to research this