Question Opening/Editing MS Excel file

ChrisX

New member
Joined
Dec 12, 2010
Messages
2
Programming Experience
Beginner
Hello, everyone. This is my first post... And I'd like to ask something.

I am trying to create a VB.NET project that involves opening an xls file. But thus far, the support codes from Microsoft always gives an error when I try it on Microsoft Visual Studio .NET 2010. Can anyone help me with a step-by-step tutorial of how to do it?

Here's the specifications that needs attention:
1. OS: Windows 7
2. Uses Microsoft Visual Studio .NET 2010
3. Uses Microsoft Office 2007

Help will be appreciated. Thank you!
 
Add Reference from COM tab to 'Microsoft Excel 12.0 Object Library'. Now you can use the library. To simplify code import the namespace:
VB.NET:
Imports Microsoft.Office.Interop.Excel
For compatibility with older samples, and IMO also easier coding I recommend aliasing the import like this:
VB.NET:
Imports Excel = Microsoft.Office.Interop.Excel
This allow you to qualify the library types with 'Excel.'
 
Hm, it works. Thanks for the tip...

Though it just works for the second part. Why does putting the first part only not making it work?
 
Older samples used older libraries which had different namespaces.
 
Back
Top