forked from farishadi/Excel_Macro_References
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSharePointSelectFile
More file actions
25 lines (19 loc) · 1004 Bytes
/
SharePointSelectFile
File metadata and controls
25 lines (19 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Public Function SharePointSelectFile(ByVal SharePointAddressString As String) As String
'This function opens sharepoint folder destination to allow user to select workbook within sharepoint folder
'function can be customized to point to sharepoint folder path and returns full selected workbook path
'if user cancels workbook selection, string will return ""
'Call method : FullSharePointWBAddress = SharePointSelectFile("Sharepoint folder directory")
Dim wbFromSharePoint As Workbook
Dim vrtSelectedItem As Variant
Dim sSharePointDir As String
sSharePointDir = SharePointAddressString
'use msoFileDialogOpen to link to Sharepoint folder
With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = sSharePointDir & "\" 'SharePoint address variable here
.AllowMultiSelect = False 'toggle multiple file(s) selection
.Show 'calls fileselect userform
For Each vrtSelectedItem In .SelectedItems
Set SharePointSelectFile = vrtSelectedItem
Next
End With
End Function