Control Excel File from datagridview

JonathanP

Member
Joined
Nov 7, 2012
Messages
8
Programming Experience
Beginner
Hi,

I want to try something but want to know if it is possible first...

I know I can read data or write data to an excel file but I was wondering can I control an excel file through the datagridview and have excel running in the background, and if any changes are made to the values in the datagrid view they can be saved to the file and vice versa. The excelfile also runs macros.

Basically the datagrid view needs to be the user interface for the excel file.

If there is a tutorial somewhere a link would be great.

Thanks
Jonathan
 
You could do that but it wouldn't be the way you think it would. There would be no direct link between the grid and the workbook. You would have to retrieve data from the workbook using Office Automation and display it in the grid. You'd then detect changes in the grid and make the correspo9nding changes to the workbook. They are two separate operations with you providing the plumbing to connect them. You'll find plenty of information around about both, so get each one working in isolation first and then you can add code to join them up.
 
Back
Top