+ Reply to Thread
Results 1 to 6 of 6

Check the name of user if workbook open

  1. #1
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Check the name of user if workbook open

    Good afternoon


    I need to get data from a specific file.

    For this I need to know if it is open by another user and if so what is the user's name.

    The path where the file is located is of type, PathStressDB = "\\Aptr.pt\srv125\DDD-Railw\5 - Planning\5.4 - Maps_DPE\01_DRR_Situations.xlsx", that is, it is on a server and not on the machine where I am working.

    Can you help me with the VBA code to, in a first stage, check if the file is open by a user, and if so, what is the user's name?

    Thank you

    Jorge Cabral

    Note: Also in - OzGrid https://www.ozgrid.com/forum/index.p...41#post1235741
    Last edited by alansidman; 05-20-2020 at 02:06 PM.

  2. #2
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Check the name of user if workbook open

    I found this function on the net - https://wellsr.com/vba/2018/excel/fi...ting-with-vba/ - made by Philip Hanebeck

    Please Login or Register  to view this content.
    It is not working and I cannot adapt to my case.

    The error that the function gives is on the line :

    Please Login or Register  to view this content.
    Run-time error '-2147217406 (80041002)'; not found

    Any help in adapting this function?


    Thanks

    Jorge
    Last edited by JCabral; 05-27-2020 at 07:33 AM.

  3. #3
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Check the name of user if workbook open

    A small correction to what I mentioned in the post above, the function, does not run correctly for my specific case, that is, when the file is somewhere on a server.

    When the file is on the local disk the function works correctly.

    Any help to resolve this issue is welcome.

  4. #4
    Registered User
    Join Date
    08-11-2012
    Location
    Ireland
    MS-Off Ver
    Excel 2012
    Posts
    1

    Re: Check the name of user if workbook open

    Quote Originally Posted by JCabral View Post
    A small correction to what I mentioned in the post above, the function, does not run correctly for my specific case, that is, when the file is somewhere on a server.

    When the file is on the local disk the function works correctly.

    Any help to resolve this issue is welcome.
    JCabral, did you get this working. I also have the same problem when my file is on a server and the path begins with '\\'. If the same file is server is mapped to a drive eg. j: then the function above works.
    I am still not able to get it to work if it's on a server.

    It would be great to find a solution

  5. #5
    Registered User
    Join Date
    11-04-2014
    Location
    Portugal
    MS-Off Ver
    XL2013/XL365
    Posts
    88

    Re: Check the name of user if workbook open

    Hi Crookesa

    I couldn't solve my problem. My problem is precisely yours.

    I'm very new to this VBA so I can't help it, and it seems that the problem is not very easy so only a vba expert can help.

    If you get a solution, I ask you to share it here.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2404 Win 11 Home 64 Bit
    Posts
    23,860

    Re: Check the name of user if workbook open

    Administrative Note:
    @crookesa
    Welcome to the forum.

    We are happy to help, however whilst you feel your request is similar to this thread, experience has shown that things soon get confusing when answers refer to particular cells/ranges/sheets which are unique to your post and not relevant to the original.

    Please see Forum Rule #4 about hijacking and start a new thread for your query.

    If you are not familiar with how to start a new thread see the FAQ: How to start a new thread
    Last edited by alansidman; 09-04-2020 at 10:05 AM.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] vba to open excel workbook if alrady open by other user show userform and exit sub
    By bluepomme in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-06-2018, 07:14 PM
  2. [SOLVED] Check for existing File name, open if exist or open new workbook if not
    By COURTTROOPER in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-09-2017, 12:32 AM
  3. [SOLVED] Macro to open workbook with a suffix (need help to check if file is already open)
    By rossi_69 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-24-2017, 11:03 AM
  4. [SOLVED] Check If workbook not open then open workbook and run code
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-22-2017, 08:26 AM
  5. [SOLVED] VBA UserForm.Value Check If User Form Buttons checked Not Working. Check Button on Open.
    By Doc.AElstein in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 05-11-2016, 05:55 PM
  6. VBA to check if user has pdf file open
    By Rerock in forum Excel Programming / VBA / Macros
    Replies: 19
    Last Post: 10-11-2014, 09:36 AM
  7. updating the master workbook whenever user click submit in check workbook
    By share knowledge in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-11-2011, 10:42 PM

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