List files on SharePoint

R

Rob B.

I'm writing a vba program to get a list of Excel files on a SharePoint Team
Website (SharePoint 2003 and Excel 2003) and am getting an error. This
program works fine when run in Excel 2007 but I get a Runtime Error "Network
Name Cannot be Found" when I run the exact same code in Excel 2003. Here is
the code:

dim wMastBook as workbook, wSharepoint as Object, f as integer, sFileList()
as string
dim sFileName as string
'where path = "https://share.domain.com/Shared Directory"
Set wSharepoint = CreateObject("WScript.Network")
On Error Resume Next
wSharepoint.removenetworkdrive "q:", True
On Error GoTo 0
wSharepoint.mapnetworkdrive "q:", wMastBook.Path 'runtime error here
ChDrive "q:"
sFileName = Dir("*.xl*")
s = 0
While sFileName <> ""
s = s + 1
ReDim Preserve sListFiles(s)
sListFiles(s) = sFileName
sFileName = Dir
Wend
wSharepoint.removenetworkdrive "q:", True

I've also tried the Application.Filesearch method with no errors but it
cannot find any files.

This is maddening since it works fine in Excel 2007 (the
Application.Filesearch method does not work in Excel 2007). Any help is
appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top