• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 246
  • Last Modified:

VBA Excel 2000 - Remove Sharing

Dear Experts,

I would like to remove share by VBA code, so the same which would be done through menu Tools/Share Workbook and removing the flag in section "All changes by more than one user..."

The macro record would do this with a single line

    ActiveWorkbook.ExclusiveAccess

but the problem it brings error message if the file is not shared originally.

Could you please advise how a check could be before this line whether the workbook is shared or not?

thanks,
0
csehz
Asked:
csehz
  • 2
2 Solutions
 
SiddharthRoutCommented:
The simplest way to do it is

On Error Resume Next
ActiveWorkbook.ExclusiveAccess
On Error GoTo 0

Sid
0
 
SiddharthRoutCommented:
If you want to do a proper check then use this

If ActiveWorkbook.MultiUserEditing Then
    ActiveWorkbook.ExclusiveAccess
End If

Open in new window


Sid
0
 
csehzIT consultantAuthor Commented:
Sid thanks very much for both
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now