Hi,

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


Function env(vn As String) As String
  env = Environ(vn)
End Function
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.