+ Reply to Thread
Results 1 to 2 of 2

Open Workbooks

  1. #1
    Registered User
    Join Date
    09-15-2006
    Location
    Brum
    Posts
    6

    Open Workbooks

    Hello, I am quite new to VBA but have come a long way in a short time.
    I found it is very similar to Basic Programming I learnt at school. I am aslo new to the forum.

    So now to my problem....

    I have 22 Workbooks that Managers input Absence details into. A Master file links to the info. They all have sheets Monday to Friday. Each day after data input the Managers click a command button that sets that days sheet to 'complete' and locks it. At the end of the week an Admin runs a macro in the master file that opens all the books (one at a time), then the macro runs a macro in the managers workbooks that resets the sheets to 'incomplete and removes all the data they have inputed.

    I need to know how I can detect if one of the managers has their wookbook open.

    I know the code below works if the books are open with the same excel app (like when I test it on my PC),

    Dim wBook As Workbook

    On Error Resume Next
    Set wBook = Workbooks("Personal.xls")

    If wBook Is Nothing Then 'Not open
    MsgBox "Workbook is not open"
    Set wBook = Nothing
    On Error GoTo 0
    Else 'It is open
    MsgBox "Yes it is open"
    Set wBook = Nothing
    On Error GoTo 0
    End If


    I need to know if one of the books are open over the network.

    I hope I have explaimed this eough for some help :P
    Last edited by asyrip; 09-15-2006 at 06:10 AM.

  2. #2
    Forum Contributor colofnature's Avatar
    Join Date
    05-11-2006
    Location
    -
    MS-Off Ver
    -
    Posts
    301
    After opening the workbook, test if it is read only

    if wbook.readonly then ...

    If someone has the file open across the network the Excel will open it read only. It won't tell you who has it open though.


    Col
    If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.

+ 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