VBA doesn't like sharing a spreadsheet

  • Thread starter Thread starter ortp01
  • Start date Start date
O

ortp01

I'm sharing a spreadsheet on a network so some of the functionality of
my VBA code is not available. I'm therefore trying to write some code
to do one thing if it's shared, do another if it's stand-alone. Is
there therefore any way of determining within VBA whether a file is
shared or not ?
 
Try

Debug.Print Workbooks("myBook.xls").MultiUserEditing

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Wonderful !! I've had to change the syntax slightly to something
like...

thissheet = ActiveWorkbook.Name
If Workbooks(thissheet).MultiUserEditing = False Then' <<<<<<<<<<
strprompt = "False : ie not shared" & vbCrLf
varReturn = MsgBox(strprompt, vbOKOnly, strTitle)
Else
strprompt = "True: ie it's shared !" & vbCrLf
varReturn = MsgBox(strprompt, vbOKOnly, strTitle)
End If

Thank you ever so much. I would not have stumbled over this syntax and
the 'Help' was unhelpful. So your help is much appreciated !

Peter
 
We are the 'Help' <vbg>

BTW this

If Workbooks(thissheet).MultiUserEditing = False Then'

can be shortened as you are doing a logivcl test, which can only evaluate to
True or false, so you can write

If Not Workbooks(thissheet).MultiUserEditing = Then

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top