How To Read Html Code In Order To Grab Data With Excel Vba
I'm trying to grab som data from a webpage with Excel VBA. The HTML code is:
Solution 1:
I would say you have 2 options:
1. DOM
.document.getElementById("skuPriceLabel").getElementsByTagName("span")(1).getElementsByTagName("span")(0).innerText
2. Regex
Use regex: content=""NOK"">(.*?)<
with this function
PublicFunction GetRegex(str AsString, reg AsString, Optional index AsInteger) AsStringOnErrorResumeNextSet regex = CreateObject("VBScript.RegExp")
regex.Pattern = reg
regex.Global = TrueIf index < 0Then index = 0If regex.test(str) ThenSet matches = regex.Execute(str)
GetRegex = matches(index).SubMatches(0)
ExitFunctionEndIf
GetRegex = ""EndFunction
Post a Comment for "How To Read Html Code In Order To Grab Data With Excel Vba"