c# - Fetch data from a Website into an Excel file with the hyperlinks in it -


when fetch data webpage excel file using macro saves data in excel file supposed be. requirement should save data in excel hyperlinks in webpage , if click hyperlink in excel should go particular website , fetch data , save information in excel file or sheet. hope makes sense. appreciated.

my macro code below:

sub gettable()  dim ieapp internetexplorer dim iedoc object dim ietable object dim clip dataobject  'create new instance of ie set ieapp = new internetexplorer  'you don’t need this, it’s debugging ieapp.visible = true  'assume we’re not logged in , go directly login page ieapp.navigate "website link" while ieapp.busy: doevents: loop until ieapp.readystate = readystate_complete: doevents: loop  set iedoc = ieapp.document  'fill in login form – view source browser control names iedoc.forms(0)     .user.value = "usernmae     .password.value = "password"     .submit end while ieapp.busy: doevents: loop until ieapp.readystate = readystate_complete: doevents: loop  'now we’re in, go page want ieapp.navigate "final webpage link" while ieapp.busy: doevents: loop until ieapp.readystate = readystate_complete: doevents: loop  'get table based on table’s id set iedoc = ieapp.document set ietable = iedoc.all.item("autonumber1")  'copy tables html clipboard , paste teh sheet if not ietable nothing     set clip = new dataobject     clip.settext "<html>" & ietable.outerhtml & "</html>"     clip.putinclipboard     sheet1.select     sheet1.range("a1").select     sheet1.pastespecial "unicode text" end if  'close 'er ieapp.quit set ieapp = nothing  end sub 

you use code hyperlinks web browser , think can export data listbox excel

dim links htmlelementcollection = webbrowser1.document.links         each link htmlelement in links             listbox1.items.add(link.getattribute("href"))         next 

source


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -