+ Reply to Thread
Results 1 to 4 of 4

VBA doesn't like sharing a spreadsheet

  1. #1
    Registered User
    Join Date
    04-20-2006
    Posts
    3

    VBA doesn't like sharing a spreadsheet

    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 ?

  2. #2
    Bob Phillips
    Guest

    Re: VBA doesn't like sharing a spreadsheet

    Try

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

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "ortp01" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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 ?
    >
    >
    > --
    > ortp01
    > ------------------------------------------------------------------------
    > ortp01's Profile:

    http://www.excelforum.com/member.php...o&userid=33689
    > View this thread: http://www.excelforum.com/showthread...hreadid=534990
    >




  3. #3
    Registered User
    Join Date
    04-20-2006
    Posts
    3

    Many, many thanks

    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



    Quote Originally Posted by Bob Phillips
    Try

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

    --
    HTH

    Bob Phillips

    (remove nothere from email address if mailing direct)

    "ortp01" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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 ?
    >
    >
    > --
    > ortp01
    > ------------------------------------------------------------------------
    > ortp01's Profile:

    http://www.excelforum.com/member.php...o&userid=33689
    > View this thread: http://www.excelforum.com/showthread...hreadid=534990
    >

  4. #4
    Bob Phillips
    Guest

    Re: VBA doesn't like sharing a spreadsheet

    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

    "ortp01" <[email protected]> wrote in
    message news:[email protected]...
    >
    > 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
    >
    >
    >
    > Bob Phillips Wrote:
    > > Try
    > >
    > > Debug.Print Workbooks("myBook.xls").MultiUserEditing
    > >
    > > --
    > > HTH
    > >
    > > Bob Phillips
    > >
    > > (remove nothere from email address if mailing direct)
    > >
    > > "ortp01" <[email protected]> wrote
    > > in
    > > message news:[email protected]...
    > > >
    > > > 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 ?
    > > >
    > > >
    > > > --
    > > > ortp01
    > > >

    > > ------------------------------------------------------------------------
    > > > ortp01's Profile:

    > > http://www.excelforum.com/member.php...o&userid=33689
    > > > View this thread:

    > > http://www.excelforum.com/showthread...hreadid=534990
    > > >

    >
    >
    > --
    > ortp01
    > ------------------------------------------------------------------------
    > ortp01's Profile:

    http://www.excelforum.com/member.php...o&userid=33689
    > View this thread: http://www.excelforum.com/showthread...hreadid=534990
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1