Write enable in Sharepiont with VBA

HeinzBrunner

New Member
Joined
Jul 6, 2018
Messages
1
Hi

I have a macro, which opens another Excel file from Sharepoint and writes data in it. To write-enable the file, I use "ActiveWorkbook.LockServerFile". This works fine with Office 2016.

Now we are changing gradually to Office 365, so some computers are equipped with with Office 2016 and some with Office 365. In Office 365, ActiveWorkbook.LokServerFile gives a run time error 1004.

When I omit this line and instead include in the file I am opening the Macro:

Private Sub Workook_Open()
ActiveWorkbook.LockServerFile
End Sub

it works in Offfice 365, but office 2016 doesn't enable editing and the main macro can't write the data.

I need a solution, which works with both, Office 2016 and 365. Can someone help?

Thanks
Heinz
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,223,630
Messages
6,173,454
Members
452,514
Latest member
cjkelly15

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top