![]() |
List files on SharePoint
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. |
All times are GMT +1. The time now is 03:11 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com