averageProg
New Member
- Joined
- Apr 6, 2021
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hello all,
My issue is related to Global Sharepoint.
Previously I was able to access via "normal" sharepoint a list of files by:
a.) dropping the http:
b.) reversing the / to \
Any working solutions or ideas to resolve my code?
In example:
Loc refers to a cell with Sharepoint Path (folder)
The Code pulls all file names from that sharepoint "folder" then places file names on consecutive cells to starting excel doc (which contains this code)
(Original) "old" sharepoint path (ex.) : http://Website.com/sites/Loc/UpFolder/Source
(Amended) "old" sharepoint path (ex.) : \\Website.com\sites\Loc\UpFolder\Source
(Original) GLOBAL "new" sharepoint path (ex.) : https://globalplace.sharepoint.com/sites/path123/Folder
(Attempted amend -- not working) ex. : \\globalplace.sharepoint.com\sites\path123\Folder
My issue is related to Global Sharepoint.
Previously I was able to access via "normal" sharepoint a list of files by:
a.) dropping the http:
b.) reversing the / to \
Any working solutions or ideas to resolve my code?
In example:
Loc refers to a cell with Sharepoint Path (folder)
The Code pulls all file names from that sharepoint "folder" then places file names on consecutive cells to starting excel doc (which contains this code)
(Original) "old" sharepoint path (ex.) : http://Website.com/sites/Loc/UpFolder/Source
(Amended) "old" sharepoint path (ex.) : \\Website.com\sites\Loc\UpFolder\Source
(Original) GLOBAL "new" sharepoint path (ex.) : https://globalplace.sharepoint.com/sites/path123/Folder
(Attempted amend -- not working) ex. : \\globalplace.sharepoint.com\sites\path123\Folder
VBA Code:
Private Sub LoopThroughFiles()
Dim oFSO As Object
Dim oFolder As Object
Dim oFile As Object
Dim i As Integer
Dim imgLOC As String
i = 1
Set oFSO = CreateObject("Scripting.FileSystemObject")
Loc = Sheets("filenames").Range("F1").Value
Set oFolder = oFSO.GetFolder(Loc)
For Each oFile In oFolder.Files
Cells(i + 1, 6) = oFile.Name
i = i + 1
Next oFile
End Sub