0

I have a C program that generates CSV files as output.

For example - I have 12 CSV files; one for each month. First column is Employee Name and Second column is their respective salaries. Assume there are 10 employees.

I want to format the 'salaries'column such that if a cell has a value over 10,000, the text should become green. Else it should remain blue. I have been able to do this using VBA for one file by adding a Command Button in the file and writing a small script.

However the issue is, every time I run my C code, it will generate a new set of CSVs; overwriting the existing ones. Besides, I want to apply such formatting to other CSV files I intend to generate.

I read that a .xla Add-In (which can exist on its own unlike embedded VBA macros in an Excel sheet) might be the solution.

I have 2 questions - 1. Is it possible to do with Add-Ins? 2. If yes, then I wanted to create a single batch file which would first generate the CSVs, and then run the Add-In on it. Is that possible too?

Thank You.

Community
  • 1
  • 1
Manu Vyas
  • 3
  • 3
  • Is there a reason why you cannot create an Excel file rather than a CSV file? Other than the obvious overhead of an Excel file. If you had an Excel file, you could then have .xla Add-in or could just use Excel object in your C program to setup conditional formating – Zac Oct 21 '16 at 11:56
  • An add-in is more geared towards distributing to end-users so thaey can run code: if this is just for your use then you don't need that. You can shell a vbscript to open an Excel file containing your formatting macro and run it. http://stackoverflow.com/questions/10232150/run-excel-macro-from-outside-excel-using-vbscript-from-command-line – Tim Williams Oct 21 '16 at 16:26
  • Thank you guys for your responses. Zac yes i required the output in CSV format only. Tim Thank you for sharing the link. It helped me a lot. – Manu Vyas Oct 27 '16 at 10:14

0 Answers0