+ Reply to Thread
Results 1 to 8 of 8

Find path to local synced sharepoint folder

Hybrid View

  1. #1
    Registered User
    Join Date
    11-10-2020
    Location
    Beringen, Belgium
    MS-Off Ver
    Office 365
    Posts
    6

    Find path to local synced sharepoint folder

    We are using sharepoint, and I have some folder synced to my PC.

    I would like to use excel vba to access those files. Is there an easy way to find the path to this synced sharepoint folder (not in the cloud, but a path to my local copy)?

  2. #2
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find path to local synced sharepoint folder

    path to your local copy? not really understanding that. VBA can look literally anywhere. but server addresses start like this:
    \\dir\dir\dir\dir\file.extension

  3. #3
    Registered User
    Join Date
    11-10-2020
    Location
    Beringen, Belgium
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Find path to local synced sharepoint folder

    See my comment to the thread below of AliGW

  4. #4
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (both in England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2504 (Windows 11 Home 24H2 64-bit)
    Posts
    90,658

    Re: Find path to local synced sharepoint folder

    When you synch a SharePoint folder to your desktop, the file path will be something like this:

    C:\Users\username\friendly name of company\department folder - Documents
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help. It's a universal courtesy.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    NB:
    as a Moderator, I never accept friendship requests.
    Forum Rules (updated August 2023): please read them here.

  5. #5
    Registered User
    Join Date
    11-10-2020
    Location
    Beringen, Belgium
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Find path to local synced sharepoint folder

    I do have that. My issue is that I have multiple persons using the macro and I do not know by heart how they organized their local synced sharepoint copy. So the drive letter might be different as well as the friendly company name.
    At the moment, I have to ask them to place a shortcut (link to sharepoint) in the favorites folder. I can search that one to see if a link is present. This is a workaround which costs time.
    I was hoping to find the path using environ("sharepoint") or similar.

  6. #6
    Banned User!
    Join Date
    02-06-2020
    Location
    Iowa City, IA, USA
    MS-Off Ver
    2016 - 365 / 2007
    Posts
    2,014

    Re: Find path to local synced sharepoint folder

    there is no environ("sharepoint") i don't believe. sharepoint is not part of the windows path.

  7. #7
    Registered User
    Join Date
    11-10-2020
    Location
    Beringen, Belgium
    MS-Off Ver
    Office 365
    Posts
    6

    Re: Find path to local synced sharepoint folder

    That was the first thing I tried. Sharepoint is by Microsoft, Windows is by Microsoft, so would be obvious.
    I can find the onedrive link (that is in environ). Sharepoint is using onedrive for business but no go.....

  8. #8
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,973

    Re: Find path to local synced sharepoint folder

    Folder and/or drive structure should really be managed by your IT group and standardized, using GPO via Active Directory Management (ex: using logon script).

    At any rate, if local drive can change, then you should use Environ("UserProfile") this will give X:\Users\UserName.

    Then you can use FileDialog to return all folders within that path and have user pick the folder they need.

    Ex:
    Sub Demo()
    Dim myFold As String
    With Application.FileDialog(msoFileDialogFolderPicker)
        .AllowMultiSelect = False
        .InitialFileName = Environ$("UserProfile") & "\"
        If .Show Then myFold = .SelectedItems(1) & "\"
    End With
    
    If Len(myFold) = 0 Then Exit Sub
    'Do something with myFold
    End Sub
    Alternately, you could use recursive logic to traverse user's folder to find folder that contains "- Documents". But I don't recommend this approach as it could a while and/or unreliable, depending on user's folder structure.
    "Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something."
    ― Robert A. Heinlein

+ 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. How to get the "local path" of excel file in sharepoint
    By diego208 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-17-2020, 02:23 PM
  2. VBA Code to copy Files From Onedrive Folder To Local Path
    By hrayani in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-08-2020, 01:29 PM
  3. [SOLVED] Find folder path for string in cell
    By efarkouh in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 07-26-2016, 09:25 AM
  4. [SOLVED] Help with Macro to find full path of Folder, using input of first 4 chars of folder name
    By Anxiety in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2015, 09:02 AM
  5. Code to list the folder path and sub folder path of a specific file
    By kalai1587 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-13-2013, 03:51 AM
  6. Excel VBA get Network path from local path
    By katto01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2013, 11:31 AM

Tags for this Thread

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