0
votes

I'm trying to open an excel file from a sharepoint site using VBA. I used the code from this page, but all it did was pull up my file explorer. I have also tried this code which I usually use for opening a closed workbook, not on a sharpoint.

dim wbk as workbook
set wbk = Workbooks.Open("Filepath")

Using this method returns an error telling me my file path is bad or non-existent, which my file path is correct. Any help would be appreciated. Thanks!

1
"Filepath" is not a valid path.braX
Use the full UNC Path to the file and it should open just fineDave

1 Answers

1
votes
Dim wbk as Workbook
Set wbk = Workbooks.Open(Filename:="\\filepath\file.xlsm", UpdateLinks:=False, ReadOnly:=True)

You need to include the syntax "filename". This iteration also opens the file as a read-only copy. To open as a file you can edit, remove the "ReadOnly:=True" portion of the code.