I have a large string that comes from the HTML source code (about 1,000,000 characters long). I am using msinet.ocx to see text from proper websites. I have written a small section of code to search for an important phrase ("pcad ="), which is just before a different key phrase ("component accessory matrix"), but it is not working properly. Here I am now:
workspace = cells (columnNumber, 1) .Value myURL = "http://beams.us.yazaki.com/Beams/ViewDetails.aspx?topic = Document & amp; pkid = "_ & amp; Vertical inet1 dim cabinet dim MyPage string set inet1 = inet1 with as the new Cabinet .Protocol = icHTTP .url = myURL MyPage = CAMnum with .OpenURL (.url, icString) = InStr end (MyPage, "Component accessory matrix ") intStart = InStrRev (MyPage," pkid = ", CAMnum) + 5 newnum = Middle (MyPage, intStart, 6) cells (columnNumber, 2) .Value = newnum The problem is with mypage =. Open URL (.URL, icString) ; When I run len (mypage) , it gives value of approximately 100,000, when it should return the value of approximately one million InStr and InStrRev
Code>, find your string, look back. Once you have this situation, look forward to as long as we do not search quote characters. Finally, use those conditions to get the string pos1 = InStrRev (your XML string, "pcad =", inset (your XML string, "component accessory matrix")) + 5 'Length' pkid = "Note that if " component accessory matrix " is unavailable, or before < Em> is not "pkid =" , or is not a bid delimiter, or more pkid = and quotation marks, the code will fail and / or generate nonsense results.
Comments
Post a Comment