VBA macro for extracting website source to a cell returns an #VALUE! error in excel -


i new in vba macros, , i'm using 1 extracts url source , when try use fill contents of particular cell in excel #value! error in cell. can help?

here code i'm using:

function getsource(url string) string    createobject("msxml2.xmlhttp")        .open "get", url            .send       do: doevents: loop until .readystate = 4      getsource = .responsetext      .abort   end   end function 

i #value error when omit "http://"; when include function works seem "well formed" pages. others seem fail.

for debugging purposes created reference "microsoft xml, v6.0" , changed code to

function getsource(url string) string dim o msxml2.xmlhttp      set o = new msxml2.xmlhttp     o.open "get", url     o.send     getsource = o.responsetext     o.abort     set o = nothing  end function 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -