Monday 15 September 2014

vba - Fill excel table from web page -



vba - Fill excel table from web page -

i want fill out excel table info in web page. how can this?

my plan far, utilize winhttprequest in excel-vba. i'm getting timeout errors :(

sub webtest() dim request winhttprequest set request = new winhttprequest request.settimeouts 2000, 2000, 2000, 2000 request.open "get", "http://www.w3schools.com/html/html_tables.asp", false request.send msgbox request.responsebody end sub

perhaps wasn't best language use, can't give on little time out errors. if can spot error allow me know, i'll glowering on until goes away

alt + d, d, w allow without code.

the url has 100% correct. unlike browser there no code prepare urls.

the purpose of programme error details.

how right url type url in browser, navigate, , right url in address bar. other way utilize properties of link etc url.

also microsoft.xmlhttp maps microsoft.xmlhttp.1.0. hkey_classes_root\msxml2.xmlhttp maps msxml2.xmlhttp.3.0. seek later one

try way using xmlhttp. edit url's etc. if seems work comment out if / end if dump info if seeming work. it's vbscript vbscript works in vb6.

on error resume next set file = wscript.createobject("microsoft.xmlhttp") file.open "get", "http://www.microsoft.com/en-au/default.aspx", false 'this ie 8 headers file.setrequestheader "user-agent", "mozilla/4.0 (compatible; msie 8.0; windows nt 6.0; trident/4.0; slcc1; .net clr 2.0.50727; media center pc 5.0; .net clr 1.1.4322; .net clr 3.5.30729; .net clr 3.0.30618; .net4.0c; .net4.0e; bcd2000; bcd2000)" file.send if err.number <> 0 line ="" line = line & vbcrlf & "" line = line & vbcrlf & "error getting file" line = line & vbcrlf & "==================" line = line & vbcrlf & "" line = line & vbcrlf & "error " & err.number & "(0x" & hex(err.number) & ") " & err.description line = line & vbcrlf & "source " & err.source line = line & vbcrlf & "" line = line & vbcrlf & "http error " & file.status & " " & file.statustext line = line & vbcrlf & file.getallresponseheaders wscript.echo line err.clear wscript.quit end if on error goto 0 set bs = createobject("adodb.stream") bs.type = 1 bs.open bs.write file.responsebody bs.savetofile "c:\users\test.txt", 2

also see if these other objects work.

c:\users>reg query hkcr /f xmlhttp hkey_classes_root\microsoft.xmlhttp hkey_classes_root\microsoft.xmlhttp.1.0 hkey_classes_root\msxml2.serverxmlhttp hkey_classes_root\msxml2.serverxmlhttp.3.0 hkey_classes_root\msxml2.serverxmlhttp.4.0 hkey_classes_root\msxml2.serverxmlhttp.5.0 hkey_classes_root\msxml2.serverxmlhttp.6.0 hkey_classes_root\msxml2.xmlhttp hkey_classes_root\msxml2.xmlhttp.3.0 hkey_classes_root\msxml2.xmlhttp.4.0 hkey_classes_root\msxml2.xmlhttp.5.0 hkey_classes_root\msxml2.xmlhttp.6.0 end of search: 12 match(es) found.

also aware there limit on how many times can phone call particular xmlhttp object before lockout occurs. if happens, , when debugging code, alter different xmlhttp object

edit

this help says.

what's new in msxml 6.0 msxml 6.0 shipped sql server 2005. shipped web release. next high-level summary of features introduced msxml 6.0.

security

a number of enhancements have been made msxml 6.0 eliminate security threats. additionally, features insecure, such dtds , inline schemas, have been turned off default. more information, see msxml security overview.

xdr schema back upwards removed

xml info reduced (xdr) schema back upwards has been removed. more information, see removal of xdr schema support.

improvements in xsd standards compliance

msxml 6.0 has improved xsd schema standards compliance. more information, see improvements in xsd standards compliance.

improvements in schema cache behavior

msxml 6.0 has changed behavior of xsd schema cache. new version less ambiguous when there name collisions. more information, see improvements in schema cache behavior.

xml digital signature removed

msxml 6.0 removed back upwards xml digital signatures. more information, see xml digital signatures.

edit 2

ports specified putting : @ end of urls. eg; http://www.microsoft.com:80

edit 3

use macro recorder in excel record info query write of code you. flexible , don't need programmed (excel non programmers programming stuff) - @ alternative dialog while setting query.

vba http

No comments:

Post a Comment