Checks if a workbook is found in a SharePoint location or not, giving a full http workbook path.
This can also be used to see if current user has access to that SharePoint location/file or not.
The check happens by trying to open that workbook, that is why you need to make sure that you close that workbook if no longer needed by passing ThenClose parameter.
Function IsThere1_SPWB(Workbook_URL, Optional ThenClose = 1)
' Checks if sharepoint spreadsheet is found or not
Dim Wbbb As Workbook
OldDisplayAll = Application.DisplayAlerts
Application.DisplayAlerts = False
On Error Resume Next
Err.Clear
Set Wbbb = Workbooks.Open(Workbook_URL, False)
If Err.Number < > 0 Then
IsThere1_SPWB = False
Else
If ThenClose = 1 Then Wbbb.Close False
IsThere1_SPWB = True
End If
Application.DisplayAlerts = OldDisplayAll
End Function
' Checks if sharepoint spreadsheet is found or not
Dim Wbbb As Workbook
OldDisplayAll = Application.DisplayAlerts
Application.DisplayAlerts = False
On Error Resume Next
Err.Clear
Set Wbbb = Workbooks.Open(Workbook_URL, False)
If Err.Number < > 0 Then
IsThere1_SPWB = False
Else
If ThenClose = 1 Then Wbbb.Close False
IsThere1_SPWB = True
End If
Application.DisplayAlerts = OldDisplayAll
End Function
Workbook_URL, Optional ThenClose = 1
Views 1,127
Downloads 423
CodeID
DB ID
ANmarAmdeen
608
Revisions
v1.0
Wednesday
February
21
2024