Solved

VBA Excel 2000 - Remove Sharing

Posted on 2011-03-25
3
228 Views
Last Modified: 2012-05-11
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
Comment
Question by:csehz
  • 2
3 Comments
 
LVL 30

Assisted Solution

by:SiddharthRout
SiddharthRout earned 500 total points
ID: 35214173
The simplest way to do it is

On Error Resume Next
ActiveWorkbook.ExclusiveAccess
On Error GoTo 0

Sid
0
 
LVL 30

Accepted Solution

by:
SiddharthRout earned 500 total points
ID: 35214186
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
 
LVL 1

Author Closing Comment

by:csehz
ID: 35214199
Sid thanks very much for both
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question