get network path name of active workbook

  • Hi guys,


    I am searching desperately for a solution how to get the network path of an open file. I know how the get it inlcuding a mapped letter (like C:\data\...), but I dont know yet how to get it with the network path (like \\srv1\data\..).


    I found a macro that gets this one after inserting the mapped letter (http://support.microsoft.com/d…aspx?scid=kb;en-us;160529), but couldnt adjust it to return the current path when I am not using the mapped letters.


    Can someone help me out?


    Thanks
    markus

  • Re: get network path name of active workbook


    Hi,


    actually I want to check whether a user opens a file within a defined folder or whether this is opened somewhere else. According to this I want to permit the user to open the file only once more or unlimited (when working online and using the defined folder).


    As every user has a different name for the server, it doesnt make sense to use the normal path, as it includes the different letters. So I only can check the path in using the network name.

  • Re: get network path name of active workbook


    To get the UNC path given it's letter or Drive then this function may help
    Just pass it the Drive letter


  • Re: get network path name of active workbook


    Thanks,


    but thats exactly the problem. I found almost the same code under the link above. But I am looking for a solution with NOT entering the letter of the drive....

  • Re: get network path name of active workbook


    In a file that I opened directly from a network location I used the following worksheet function.


    =CELL("filename",A1)


    it returned: \\Csofileserver\prod_project\Photo\[AutoRunRate.xls]Sheet3


    mapping a network drive to the location the same function returned


    G:\Photo\[AutoRunRate.xls]Sheet3



    However, I did remeber this function


    =INFO("directory")


    and it returned



    \\Csofileserver\prod_project\Libraries\



    when the file was opend via a mapped network drive.

  • Re: get network path name of active workbook


    thats strange.. mine still returns the mapped path.


    but maybe i ask for the normal path, then read the mapped letter and use afterwards the other function, inserting the letter.


    is not really nice, but better than nothing..

  • Re: get network path name of active workbook


    Quote from xmarkusx;181941

    I am searching desperately for a solution how to get the network path of an open file. I know how the get it including a mapped letter (like C:\data\...), but I don't know yet how to get it with the network path (like \\srv1\data\..).


    I realize this thread is old, however, I had a similar question and was able to find an answer. Thought I'd share it for others. The Below will return the UNC path of the open workbook. Useful if the Workbook resides on a Network Share.


    Code
    MsgBox Application.CommandBars("Web").Controls("Address:").Text

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!