SharePoint 2010: Link to open Excel file in edit-mode mode

Homie picture Homie · Feb 21, 2013 · Viewed 13.2k times · Source

I have an application with a button. This button refers to an Excel document I have on a SharePoint. However, it will download the file which means it's read-only. Now, there's an option in the SharePoint to open the file in edit-mode and I would like my button to do the same - how can I use the link href to link to the file and open it in edit-mode?

enter image description here

How can I do the same action as the "Edit in Microsoft Excel" using a button outside the SharePoint? Like a link to the file that will open it in editing mode.

Answer

Jason222 picture Jason222 · Sep 18, 2014

This does not "Edit in Microsoft Excel" option but the "Check Out".

To "Edit in Microsoft Excel" the solution is unbelievably easy. In the Workbook_Open just do ActiveWorkbook.LockServerFile. The documentation for this command says it locks the workbook, but in this case it does the exact opposite, it simply executes the Edit bar question.

Private Sub Workbook_Open()

'The following command is equivalent to hitting the "Edit" bar 
'that comes up when you open an Excel file by clicking on it in SharePoint,
'which is equivalent to "Edit in Microsoft Excel" (not CheckOut)

ActiveWorkbook.LockServerFile

End Sub