I am writing a macro to open and update an Excel file in SharePoint online using Excel in Office 365.
I can open the file but it open as read only. I found the solution to add ActiveWorbook.LockServerFile after opening the file but I get application-defined or object-defined error when I execute that statement.
Here is my code: Workbooks.Open Filename:=FilePath & WBName, ReadOnly:=False, Editable:=True ActiveWorkbook.LockServerFile
I have also tried adding: ActiveWorkbook.ChangeFileAccess Mode:=xlReadWrite but it tells me the workbook is locked for editing by 'another user'
When I close excel and open the workbook from SharePoint manually, it opens for update and I can save the workbook.
I can open the file but it open as read only. I found the solution to add ActiveWorbook.LockServerFile after opening the file but I get application-defined or object-defined error when I execute that statement.
Here is my code: Workbooks.Open Filename:=FilePath & WBName, ReadOnly:=False, Editable:=True ActiveWorkbook.LockServerFile
I have also tried adding: ActiveWorkbook.ChangeFileAccess Mode:=xlReadWrite but it tells me the workbook is locked for editing by 'another user'
When I close excel and open the workbook from SharePoint manually, it opens for update and I can save the workbook.