Do not share workbook

mnman

New Member
Joined
Dec 27, 2020
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
Hi All,

Thanks to MrExcel.com I got a new job doing Excel related work.
Unfortunately ☹️I never made a copy of my personal file from my old job.
I need code to prevent the sharing of my workbooks.
I believe I found it on MrExcel about 15 years ago.
It was simple 4 or 5 lines of code that prevented the sharing of the workbook. Something like Shareworkbook:Disable.

Thank you in advance.
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi mnman,

Check below VBA if this fulfil your requirement:

If ActiveWorkbook.MultiUserEditing Then
ActiveWorkbook.ExclusiveAccess
End If

ExclusiveAccess method assigns the current user exclusive access to the workbook that's open as a shared list.
MutliUserEditing is True if the workbook is open as a shared list.
 
Upvote 0
Solution
Thanks for replying. If resolved please mark the response as solution.
 
Upvote 0

Forum statistics

Threads
1,215,062
Messages
6,122,923
Members
449,094
Latest member
teemeren

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