Use VB. NET to write a program for excel Control
In the past, we always wrote some VBA programs in excel, which basically solved the problem by hundreds of lines of code. I have never used VC, VB, or Delphi to do this kind of thing. If I want to make reports, the relative scale and functions should be more, which should be the focus of excel Development.
This time I used VB. NET to develop a small program to access excel to read data and modify the data. Some Empirical things are shared with you. If there is any error, please correct me.
It can be roughly divided into the following parts:
1. preparation:
In the preparation section, we need to add the excel library reference to the project: I use office2003, and its library file is Microsoft excel 11.0 object library. If excel2000 is used, Microsoft excel 9.0 object library is used.
Add the Imports namespace as needed.
In this program, I only access the excel data and do not need a namespace.
2. Declare some objects: