Lynn
Sat Feb 19 23:08:44 CST 2005
i am totally new to this xml stuffs..
can i know how to fit this code into an office macro?
"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:%23hQridsFFHA.2832@TK2MSFTNGP14.phx.gbl...
> > WSH version:
> >
> > Option Explicit
> >
> > function checkURL(file)
> > Dim oHTTP, status
> > set oHTTP = CreateObject("MSXML2.ServerXMLHTTP")
> > oHTTP.open "GET", file, False
>
> If all you want to do is verify existence, it's cheaper to do a HEAD
request
> rather than a GET which returns content that is not used by the client...
>
> oHTTP.open "HEAD", file, False
>
> This returns the same status code, etc. but no responseBody or
responseText,
> only the http headers (access using oHTTP.getAllResponseHeaders() or
> getResponseHeader(bstrHeader)).
>
>
> > oHTTP.send
> > status = oHTTP.Status
> > if status = 200 then
> > checkURL = " exists!"
> > else
> > checkURL = " does not exists."
> > end if
> > set oHTTP = nothing
> > end function
> >
> > dim fExists, vFilename
> > vFilename = "
http://www.kiddanger.com/default.asp"
> > fExists = checkURL(vFilename)
> > wscript.echo vFilename & fExists
> >
> > vFilename = "
http://www.kiddanger.com/unknownfile.asp"
> > fExists = checkURL(vFilename)
> > wscript.echo vFilename & fExists
> >
> > ASP version:
> >
http://kiddanger.com/lab/geturl5.asp
>
> --
> Michael Harris
> Microsoft MVP Scripting
>
http://maps.google.com/maps?q=Sammamish%20WA%20US
>
>