Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search SharePoint for Workbook
Is there a way to search a SharePoint site to see if a Workbook exists? I have CanCheckOut working, but the problem is that if the workbook is already checked-out or if it doesn't exist I think I get the same response(can't checked-out). If the Workbook is already checked-out then I will display a message "The file is already checked out. Try again later". However, if the file does not exits then I want to search for an earlier file. Thanks for your time and expertice in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search SharePoint for Workbook
Here's a User-Defined-Function that might help... '/===============================/ ' Function Purpose: ' Return TRUE or FALSE ' strFileName should be full path ' and filename ' i.e. "C:\Temp\MyFile.xls" '/===============================/ ' Public Function FileExists(strFileName As String) _ As Boolean On Error GoTo err_Function FileExists = False If Dir(strFileName) < "" Then FileExists = True End If exit_Function: On Error Resume Next Exit Function err_Function: Debug.Print "Error: " & Err.Number & " - (" & _ Err.Description & _ ") - Function: FileExists - Module: " & _ "Mod_Functions_FileExists - " & Now() GoTo exit_Function End Function '/===============================/ -- Hope this helps. If it does, please click the Yes button. Thanks in advance for your feedback. Gary Brown "carmjo005" wrote: Is there a way to search a SharePoint site to see if a Workbook exists? I have CanCheckOut working, but the problem is that if the workbook is already checked-out or if it doesn't exist I think I get the same response(can't checked-out). If the Workbook is already checked-out then I will display a message "The file is already checked out. Try again later". However, if the file does not exits then I want to search for an earlier file. Thanks for your time and expertice in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Search SharePoint for Workbook
Thanks Gary. I've tried something similar but just can't get "Dir" to work within SharePoint(even with your code). My path and filename are correct and work fine with Open(read-only), CanCheckOut and CanCheckIn. Used a work around to first try to Open the workbook which generates no error if it exists - seems to work but sloppy Appreciate your help "Gary Brown" wrote: Here's a User-Defined-Function that might help... '/===============================/ ' Function Purpose: ' Return TRUE or FALSE ' strFileName should be full path ' and filename ' i.e. "C:\Temp\MyFile.xls" '/===============================/ ' Public Function FileExists(strFileName As String) _ As Boolean On Error GoTo err_Function FileExists = False If Dir(strFileName) < "" Then FileExists = True End If exit_Function: On Error Resume Next Exit Function err_Function: Debug.Print "Error: " & Err.Number & " - (" & _ Err.Description & _ ") - Function: FileExists - Module: " & _ "Mod_Functions_FileExists - " & Now() GoTo exit_Function End Function '/===============================/ -- Hope this helps. If it does, please click the Yes button. Thanks in advance for your feedback. Gary Brown "carmjo005" wrote: Is there a way to search a SharePoint site to see if a Workbook exists? I have CanCheckOut working, but the problem is that if the workbook is already checked-out or if it doesn't exist I think I get the same response(can't checked-out). If the Workbook is already checked-out then I will display a message "The file is already checked out. Try again later". However, if the file does not exits then I want to search for an earlier file. Thanks for your time and expertice in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel hyperlink within workbook and SharePoint drafts | Excel Discussion (Misc queries) | |||
Sharepoint: How do I upload Excel (2003) Reports to Sharepoint? | Excel Programming | |||
Excel links & SharePoint 3.0 (worked fine with SharePoint 2.0) | Excel Discussion (Misc queries) | |||
Sharing a workbook in Sharepoint or another web-based doc mgmt sys | Excel Discussion (Misc queries) | |||
SharePoint instead of Share Workbook? | Excel Discussion (Misc queries) |