Genralise Username in file path

Hello everyone, I recently completed automating an excel file with UI Path. However, the file path contains my name and i would like to make it available for everyone to use the bot. How do i code such that the bot can open the same file whenever any other person uses it:
e.g “C:\Users\Jane.Mwambazi\Reports\Tempo Master\financial Reports v1.0.xlsx”

Many thanks.

Hi @Kabuswe1

If we consider that all the users have the same path in their respective machines the syntax for the excel path should be :
"C:\Users\"+Environment.UserName+"\Reports\Tempo Master\financial Reports v1.0.xlsx"
Otherwise it would be good if you share the file an you can all access it using the same path, you should be in the same network though.

Regards,
Reda

4 Likes

This might work better, and get the default Users folder path:
Environment.GetEnvironmentVariable(“USERPROFILE”)+"\Reports\Tempo Master\financial Reports v1.0.xlsx"

3 Likes

Thank you so much reda. It worked.:raised_hands::ok_hand::+1:

Glad it worked :grinning::grinning:
[Please close thread by marking the right answer as solution]

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.