473,324 Members | 2,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 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
user.

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)
Else
IsNewBook = True
oBook = CType(oExcel.Workbooks.Add(),
Microsoft.Office.Interop.Excel.Workbook)
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?

Thanks
Aug 8 '05 #1
0 1215

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Savas Ates | last post by:
i cant delete data from excell which i use as a database with asp .. i encounter an error report about isam. how can i delete data from excell help meee!
1
by: Mustafa | last post by:
I have an ASP script where i am generating the excell sheet dynamically i am passing some column header text which is long text so i want it to display it vertically in column (cell).In excell i...
0
by: banderas | last post by:
Just wondering if it is possible to use access to create grpahs and even print reports? Is it possible to link excell with access so one can be the date base and when graphs and analytical reports...
0
by: GordonC | last post by:
How can I create a dll that can be called from 2002 VBA? I have created a COM Add-in following the instructions Microsoft article 302901. I can not reference the resulting dll in VBA for...
2
by: Robert Halstead | last post by:
Hi guys, I have a asp.net web app and it's connecting to an excell 2003 document (in another folder) via OleDataAdapter. Everything works and all, it's just that when I shutdown IE and try to...
0
by: Franky | last post by:
I would like to create a new blank excel and set some header columns for the user. I try this code. It's work with Excel 2003 English but a got a error line 2 with all other version. (Excel...
2
by: glibo | last post by:
I am trying to change the tab name when i open a excell spread sheet on the run time in c#. I changed it in the code: Response.AddHeader("content-disposition","filename=" + sFileName + ".xls");...
2
by: Bram2008 | last post by:
How to use macro in excel? Can i get some code to record excell data to vb? O y, i have project in vb, and i write data in vb, then i transfer it to excell to build chart. This is my code : ...
1
Ali Rizwan
by: Ali Rizwan | last post by:
Hi all, I m creating a database. The data for database will fetched from an excell sheet. Now how can i read an excell sheet and update my database with that excell sheet. Or I want to show...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.