+ Reply to Thread
Results 1 to 6 of 6

Dynamic 'username' in external link

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    8

    Dynamic 'username' in external link

    Hi,

    I use a little VBA code to get the user profile details.

    Please Login or Register  to view this content.
    I want to make sure that whoever uses the Workbook will have the links updated with their username so they can access data from SharePoint.

    I a use the below formula to create an external link to fetch value.

    =env("USERPROFILE")&"\SharePoint\Reports\Services\[Stats.xlsx]AIR!'$AW42"

    Unfortunately instead of getting the value the cell which contains the formula show the formula itself.

    C:\Users\Kramart\SharePoint\Reports\Services\[Stats.xlsx]AIR!'$AW42

    How can I make this work? I need the link to have the correct username details plus the link to work.

    Thanks,

    A.

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

    Re: Dynamic 'username' in external link

    You need to concatenate "=" sign before env(). Without it, it's treated as string and won't evaluate.

    Though, in general, I'd not recommend linked formula to file stored in SharePoint. I prefer to use SharePoint list and use linked table with live connection to the list.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    08-21-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Dynamic 'username' in external link

    Thanks. I am afraid that your approach doesn't work. Unless I am doing something wrong.
    I've tried:

    ="="&env("USERPROFILE")&"\SharePoint\Reports\Services\[Stats.xlsx]AIR!'$AW42"
    "="&env("USERPROFILE")&"\SharePoint\Reports\Services\[Stats.xlsx]AIR!'$AW42"
    =CONCATENATE("="&env("USERPROFILE")&"\SharePoint\Reports\Services\[Stats.xlsx]AIR!'$AW42")

    ???

  4. #4
    Forum Expert KOKOSEK's Avatar
    Join Date
    08-03-2018
    Location
    Pole in Yorkshire, UK
    MS-Off Ver
    365/2013
    Posts
    2,742

    Re: Dynamic 'username' in external link

    You can always run this:

    Please Login or Register  to view this content.
    in

    Please Login or Register  to view this content.
    Happy with my answer * Add Reputation.
    If You are happy with solution, please use Thread tools and mark thread as SOLVED.

  5. #5
    Registered User
    Join Date
    08-21-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Dynamic 'username' in external link

    Thanks.

    The issue is that the workbook will have many links therefore there will be many cell references.


    Please Login or Register  to view this content.
    how can I deal with it? The line above would have to have dynamic cell reference so it would work on multiply cells.

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

    Re: Dynamic 'username' in external link

    Without knowing your workbook structure and relationship between your source and destination. Bit hard to help you.

    If you have set logic that you can work with... use string manipulation etc to construct formula string.
    Ex: if values are in same cell in source and destination. You can just use the .Address property of target cell to construct formula.
    Or if you need offset it by certain number of rows/columns you can use .OFFSET(x, y).Address

+ 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. Dynamic link to external picture..?
    By Ferlev in forum Excel General
    Replies: 2
    Last Post: 03-16-2018, 07:00 AM
  2. Replies: 2
    Last Post: 09-29-2014, 01:14 AM
  3. External Workbook Link with Dynamic Cell Reference
    By mst3kr in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-24-2014, 10:24 PM
  4. Link and update a dynamic excel cell range to external jpeg image
    By oscar.mz15 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-21-2013, 02:19 PM
  5. dynamic link to external data
    By jtravis77 in forum Excel General
    Replies: 1
    Last Post: 07-02-2009, 04:21 PM
  6. Change external data source depending on username
    By Jack M in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-04-2009, 10:56 AM
  7. External Workbook Link with Dynamic Name
    By AdamParker in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-13-2009, 01:26 PM

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