Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am writing code to go out to a sharepoint and grab files from the
sharepoint. I have encountered lots of issues as my workplace doesn't have that handy .ocx library that has the ability to detect if files exist on the internet. I cannot install 3rd party applications or use anything that isn't in the general system ghost. So I was hoping there would be a Windows API call that could detect if a file/website exists. Currently I have the following (which I grabbed partially from another site). It detects if a file exists at a website, but if the website doesn't exist it just creates the file and returns 1 saying the file exists: Public Function InternetFileExists(sPath As String) As Long Dim HTML As HTMLDocument Dim tHTML As HTMLDocument Dim lRet As Long On Error GoTo CATCHERROR 'Create new HTML Doc Set tHTML = New HTMLDocument 'Create a document from the URL Path Set HTML = tHTML.createDocumentFromUrl(sPath, vbNullString) 'wait for the document to load Do While HTML.readyState < "complete" DoEvents Loop 'Test to see if a 404 or similar error is found If InStr(1, LCase(HTML.body.innerText), "not found") 0 Then lRet = 0 Else lRet = 1 End If QUICKEXIT: InternetFileExists = lRet 'Clear Variables Set HTML = Nothing Set tHTML = Nothing Exit Function CATCHERROR: lRet = -1 Resume QUICKEXIT End Function 'InternetFileExists -- ********************* J Streger MS Office Master 2000 ed. MS Project White Belt 2003 User of MS Office 2003 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mon 1er message sur ce site internet faisant suite à des béné | Excel Discussion (Misc queries) | |||
Importing Soccer results from Internet Site | Excel Programming | |||
Detecting Change in State of Internet Explorer | Excel Programming | |||
internet explorer not able to open site | Excel Discussion (Misc queries) | |||
Download a CSV file from an internet site | Excel Programming |