K
Ker_01
The code below is part of my code that cycles through server pages to parse
them. It takes so long to work (much less get to the pages of interest) that
I'm having difficulty testing, so I found one page that has content of
interest and saved it to my desktop. Now I want to (temporarily) load that
page instead of a page from the server to test regex expressions for parsing
the pages.
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.setTimeouts 0, 0, 0, 0
URL = "C:\Documents and Settings\User\Desktop\SamplePage1.htm"
objHTTP.Open "GET", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible;
MSIE 6.0; Windows NT 5.0)"
objHTTP.send ("")
SourceHTMLText = objHTTP.responseText
Unfortuately, on the objHTTP.Open "GET", URL, False line I get the following
error:
Run-time error '-2147467269 (80004005)': unspecified error, presumably
because I'm not connecting through a server?
If I can't open the page as an HTML file, the other option would be to open
it as a flat file- what I really need is the multiline mega-string of the
file text so I can manipulate it with my test regex statements, so I don't
want to load a line at a time and don't want Excel to add any best guesses
at delimiters. When I look at sample code it all seems to read a line at a
time (opentext method, etc)- is there an easier way to just load the entire
..htm file at once as a single string?
Thanks!
Keith
them. It takes so long to work (much less get to the pages of interest) that
I'm having difficulty testing, so I found one page that has content of
interest and saved it to my desktop. Now I want to (temporarily) load that
page instead of a page from the server to test regex expressions for parsing
the pages.
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.setTimeouts 0, 0, 0, 0
URL = "C:\Documents and Settings\User\Desktop\SamplePage1.htm"
objHTTP.Open "GET", URL, False
objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible;
MSIE 6.0; Windows NT 5.0)"
objHTTP.send ("")
SourceHTMLText = objHTTP.responseText
Unfortuately, on the objHTTP.Open "GET", URL, False line I get the following
error:
Run-time error '-2147467269 (80004005)': unspecified error, presumably
because I'm not connecting through a server?
If I can't open the page as an HTML file, the other option would be to open
it as a flat file- what I really need is the multiline mega-string of the
file text so I can manipulate it with my test regex statements, so I don't
want to load a line at a time and don't want Excel to add any best guesses
at delimiters. When I look at sample code it all seems to read a line at a
time (opentext method, etc)- is there an easier way to just load the entire
..htm file at once as a single string?
Thanks!
Keith