Open CSV file in Dynamic Folder

excel

#1

Hi!

How can I open a csv file in a dynamic folder?

The idea is I will send my project to my colleague but the path will change on his machine. Please see sample below.

My Machine Path will be:
“C:\Users\MyName\User Info.csv”

His Path:
“C:\Users\HisName\User Info.csv”

Now im thinking if he execute the project in his machine it will give an error.

Please help.

Thank you.


#2

Hi,

This will give your the current logged in user name,

“C:\Users”+Environment.UserName+ "\User Info.csv”


#3

“C:\Users"+System.Environment.MachineName+"\User Info.csv”


#4

Even we convert this code to get desired output, it will give the machine name only I guess.

“C:\Users” + System.Environment.MachineName +"\User Info.csv", but @criskitz looking for user directory from Users path.


#5

It works! thanks you are awesome!