I have a project that let's say loads a excel file to a string using this connection:
string PATH = @"C:\localfile\user\bob\firstcomputer\file.xlsx";
string connection = "Provider=Microsoft.ACE.OLEDB.12.0;
Data Source=" + PATH + ";Extended Properties=Excel 12.0";
......... ..... ...blah blah blah loads excel to string ect.
I want to use this visual project on another computer without having to change the string path to match that computer's. Is there a way to reference that file so that using it on any computer will work without changing the path in the first place?
You would write a program that would ask for a location of a file before launching the application. The only computer specific data I see in your code is the location of the file. You might also add error checking to determine if it could find excel and the related OLEDB provider.