471,310 Members | 1,031 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,310 software developers and data experts.

how to create Excell Book with .net

I would like to create a new blank excel and set some header columns for the

I try this code. It's work with Excel 2003 English but a got a error line 2
with all other version. (Excel 2003 french, Excel 2000, etc.)
Dim oExcel As New Microsoft.Office.Interop.Excel.Application
Dim oBook As Microsoft.Office.Interop.Excel.Workbook

Dim IsNewBook As Boolean = False
If File.Exists(FileName) Then
oBook = oExcel.Workbooks.Open(FileName)
IsNewBook = True
oBook = CType(oExcel.Workbooks.Add(),
End If

If oBook Is Nothing Then
Return False
End If

Dim oCell As Microsoft.Office.Interop.Excel.Range
oCell = oExcel.Range("A1")
oCell.Value2 = "LOCATION"

I use the reference:
Name: Microsoft.Office.Interop.Excel
Description: Microsoft Excel 11.0 Object Library

can someone can help me?

Aug 8 '05 #1
0 1125

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Savas Ates | last post: by
1 post views Thread by Mustafa | last post: by
reply views Thread by GordonC | last post: by
2 posts views Thread by Robert Halstead | last post: by
reply views Thread by Franky | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.