I want to open an excel file in a Sharepoint list via VBA. Here is my code:
Sub OpenWB()
Dim SummaryWB As Workbook
Dim vrtSelectedItem As Variant
With Application.FileDialog(msoFileDialogOpen)
.InitialFileName = "https://sharepoint.com/teams/sdeteam/Shared Documents/folder/ALM Automated Transfer/" & "\"
.AllowMultiSelect = False
.Show
For Each vrtSelectedItem In .SelectedItems
Set SummaryWB = Workbooks.Open("Financial Trackerv8.xlsx")
Next
End With
If SummaryWB Is Nothing Then Exit Sub
End Sub
It only opens the folder but not the file. What's supposed to be wrong with my code?