Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Excel > Shared Workbooks


Reply
 
Thread Tools Display Modes
  #1  
Old 04-24-2012, 01:55 AM
iabbott iabbott is offline
Junior Contributor
 
Join Date: Jun 2010
Posts: 303
Default Shared Workbooks


Hi

I have a shared workbook, and I would like to know how to tell in code whether it is currently Shared or Exclusive (since certain things like deleting sheets can't be done while the workbook is shared)

I will use this to enable a button when the workbook is exclusive, and disable it when it is shared

I have tried the MultiUserEditing Property but this doesn't seem to work properly, the button is on a userform and is disabled by default, and code in Userform.Initialize will enable it when the workbook is not shared, but when I go into it in the shared workbook, the button is enabled as well...

The code I used is
Code:
If ActiveWorkbook.MultiUserEditing = False Then CommandButton1.Enabled=True
Thanks
Reply With Quote
  #2  
Old 04-24-2012, 08:07 PM
Kluz's Avatar
Kluz Kluz is offline
Sapience.Aquire

Super Moderator
* Expert *
 
Join Date: Oct 2003
Location: Lake Bluff, Ill., U.S.
Posts: 3,327
Default

I've never used the MultiUserEditing property before, does it refer to the potential of the workbook to be multi-used or if it's being multi-used at the present time?
Have you tried to have another person have the book open on another comp/user name when you test this code?
__________________
No the other right mouse click
Reply With Quote
  #3  
Old 04-25-2012, 03:10 AM
iabbott iabbott is offline
Junior Contributor
 
Join Date: Jun 2010
Posts: 303
Default

OK I did a bit more playing around..

This does work as I expected (it will disable the button if the workbook is shared, regardless of if I'm the only one in it), but I had to close the workbook after changing from/to shared before it changed the status of the button

Very strange...
Reply With Quote
  #4  
Old 04-25-2012, 07:06 PM
Kluz's Avatar
Kluz Kluz is offline
Sapience.Aquire

Super Moderator
* Expert *
 
Join Date: Oct 2003
Location: Lake Bluff, Ill., U.S.
Posts: 3,327
Default

Glad to see you've got it figured out.
__________________
No the other right mouse click
Reply With Quote
  #5  
Old 04-26-2012, 01:21 AM
iabbott iabbott is offline
Junior Contributor
 
Join Date: Jun 2010
Posts: 303
Default

thanks for your help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->