excel - How to Login to website using macro and fetch whole data html table -
i want make macro fetcher first login website fetch html table data. had fetched html table data website doesn't have login page got first page data in excel sheet. need pages data of table first login webpage. here code html table data website.
sub macro1() ' ' macro1 macro ' activesheet.querytables.add(connection:= _ "url;https://datatables.net/examples/basic_init/alt_pagination.html" _ , destination:=range("$a$1")) .name = "alt_pagination.html" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xlselectedtables .webformatting = xlwebformattingnone .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition = false .webdisableredirections = false .refresh backgroundquery:=false end activewindow.smallscroll down:=-36 end sub
i have done separately.first macro login website through ie , second whole html table data.
sub login() set ie = createobject("internetexplorer.application") ie.visible = true ie.navigate ("https://www.facebook.com/?id=" & activecell) 'enter website url if ie.readystate = 4 ie.visible = true exit else doevents end if loop ie.document.forms(0).all("opername").value = "myuser" 'enter username ie.document.forms(0).all("password").value = "mypass" 'enter password ie.document.forms(0).submit end end sub sub macro1() activesheet.querytables.add(connection:= _ "url;https://datatables.net/examples/basic_init/alt_pagination.html" _ , destination:=range("$a$1")) .name = "alt_pagination.html" .fieldnames = true .rownumbers = false .filladjacentformulas = false .preserveformatting = true .refreshonfileopen = false .backgroundquery = true .refreshstyle = xlinsertdeletecells .savepassword = false .savedata = true .adjustcolumnwidth = true .refreshperiod = 0 .webselectiontype = xlselectedtables .webformatting = xlwebformattingnone .webpreformattedtexttocolumns = true .webconsecutivedelimitersasone = true .websingleblocktextimport = false .webdisabledaterecognition = false .webdisableredirections = false .refresh backgroundquery:=false end end sub
Comments
Post a Comment