Click here to Skip to main content
15,886,963 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do I save a .csv file in the same directory as the input file? Here is the code:

C#
exc.ActiveWorkbook.SaveCopyAs(@"C:\Users\Mylaptop\Desktop\MyList.csv");
              //exc.ActiveWorkbook.SaveCopyAs("MyList.csv");
              exc.ActiveWorkbook.Saved = true;
              exc.Quit();


Right now it is hard coded to my desktop but the commented out code I can't find???
Posted

1 solution

string saveAsPath = System.IO.Path.GetDirectoryName(inputFile);
string saveAsFile = System.IO.Path.Combine(saveAsPath, "MyList.csv");
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900