| | |
use excel in vb.net 2003
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Oct 2005
Posts: 1
Reputation:
Solved Threads: 0
Hello
I need to connection beetween VB.Net 2003 and Excel 2003 and use excel 2003 object
I add Excell 11.0 Library to my project and write this code :
--------------------------------------------------------
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
'Insert data
xlSheet.Cells(1, 2) = 5000
-------------------------------------------------------------
but my project stopped in this line :
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
and view this Error :
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Excel Sheet Tasks.exe
Additional information: Old format or invalid type library.
Please help me to OBVIATION my problem
with thanks,
regards,
sharif lotfi
p_d_1382@yahoo.com
I need to connection beetween VB.Net 2003 and Excel 2003 and use excel 2003 object
I add Excell 11.0 Library to my project and write this code :
--------------------------------------------------------
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
'Insert data
xlSheet.Cells(1, 2) = 5000
-------------------------------------------------------------
but my project stopped in this line :
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
and view this Error :
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Excel Sheet Tasks.exe
Additional information: Old format or invalid type library.
Please help me to OBVIATION my problem
with thanks,
regards,
sharif lotfi
p_d_1382@yahoo.com
•
•
Join Date: May 2006
Posts: 1
Reputation:
Solved Threads: 0
Dim App As New Excel.Application
App.Visible = True
App.Application.SheetsInNewWorkbook = 1
Dim Destination As Excel.Workbook = App.Workbooks.Add()
Dim Destination_Sheet As Excel.Worksheet = Destination.Sheets(1)
'Updates the cells with labels
Destination_Sheet.Range("A1").Value = Now
Destination_Sheet.Range("A2").Value = "CATEGORY"
Destination_Sheet.Range("B2").Value = "DESCRIPTION"
'Set row to insert data
SSRow = 3
'looping occurs here
tempCell = "A" & Trim(Str(SSRow))
Destination_Sheet.Range(tempCell).NumberFormat = "@"
Destination_Sheet.Range(tempCell).Value = Category
tempCell = "B" & Trim(Str(SSRow))
Destination_Sheet.Range(tempCell).Value = Description
tempCell = "C" & Trim(Str(SSRow))
SSRow = SSRow + 1
'looping ends here
'Autofit Columns
Destination_Sheet.Columns.AutoFit()
'Shade Column headers
Destination_Sheet.Range("A2", "C2").Interior.ColorIndex = 15
'Save woorkbook
Destination_Sheet.SaveAs(DestinationPath.Text & "FileName.XLS")
App.Workbooks.Close()
App.Quit()
Maybe this will help,
Loyd
App.Visible = True
App.Application.SheetsInNewWorkbook = 1
Dim Destination As Excel.Workbook = App.Workbooks.Add()
Dim Destination_Sheet As Excel.Worksheet = Destination.Sheets(1)
'Updates the cells with labels
Destination_Sheet.Range("A1").Value = Now
Destination_Sheet.Range("A2").Value = "CATEGORY"
Destination_Sheet.Range("B2").Value = "DESCRIPTION"
'Set row to insert data
SSRow = 3
'looping occurs here
tempCell = "A" & Trim(Str(SSRow))
Destination_Sheet.Range(tempCell).NumberFormat = "@"
Destination_Sheet.Range(tempCell).Value = Category
tempCell = "B" & Trim(Str(SSRow))
Destination_Sheet.Range(tempCell).Value = Description
tempCell = "C" & Trim(Str(SSRow))
SSRow = SSRow + 1
'looping ends here
'Autofit Columns
Destination_Sheet.Columns.AutoFit()
'Shade Column headers
Destination_Sheet.Range("A2", "C2").Interior.ColorIndex = 15
'Save woorkbook
Destination_Sheet.SaveAs(DestinationPath.Text & "FileName.XLS")
App.Workbooks.Close()
App.Quit()
Maybe this will help,
Loyd
•
•
Join Date: Jun 2008
Posts: 7
Reputation:
Solved Threads: 0
go through the following link about connect excel file through vb.net.
http://vb.net-informations.com/excel..._open_file.htm
thanks.
http://vb.net-informations.com/excel..._open_file.htm
thanks.
•
•
Join Date: Jul 2009
Posts: 1
Reputation:
Solved Threads: 0
•
•
•
•
Hello
I need to connection beetween VB.Net 2003 and Excel 2003 and use excel 2003 object
I add Excell 11.0 Library to my project and write this code :
--------------------------------------------------------
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
'Insert data
xlSheet.Cells(1, 2) = 5000
-------------------------------------------------------------
but my project stopped in this line :
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
and view this Error :
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Excel Sheet Tasks.exe
Additional information: Old format or invalid type library.
Please help me to OBVIATION my problem
with thanks,
regards,
sharif lotfi
p_d_1382@yahoo.com
Dim CellRead As String
Dim excel As Microsoft.Office.Interop.Excel.Application
Dim wb As Microsoft.Office.Interop.Excel.Workbook
Dim ws As Microsoft.Office.Interop.Excel.Worksheet
Dim wr As Microsoft.Office.Interop.Excel.Range
Try
excel = CType(CreateObject("Excel.Application"), Microsoft.Office.Interop.Excel.Application)
wb = excel.Workbooks.Open("C:\Yourfile.xls")
excel.Visible = True
wb.Activate()
Catch ex As Exception
MessageBox.Show("Error: " + ex.ToString())
End Try
ws = wb.Sheets(1)
wr = ws.Range("A1", "AB25")
CellRead = wr.Cells.FormulaR1C1(1, 1)
![]() |
Similar Threads
- template link errors in visual studio .net 2003 (C)
- Visual Studio 6.0 or Visual Studio .Net 2003? (Windows Software)
- Visual Studio 6.0 or Visual Studio .Net 2003 (C++)
- how to update visual studio .net 2003 (ASP.NET)
- how to run .net 2003 trial version on Terminal server 2000 (VB.NET)
Other Threads in the VB.NET Forum
- Previous Thread: Report issue
- Next Thread: How do i insert code for showing erros in an application
| Thread Tools | Search this Thread |
.net .net2008 2008 access advanced application array basic beginner browser button buttons center click client code combo convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel exists fade filter forms function generatetags gridview html images input internet listview map mobile module monitor msaccess net number objects open panel pdf picturebox picturebox2 port position print printing problem read regex remove right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey temperature textbox timer timespan transparency txttoxmlconverter user usercontol vb vb.net vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms winsock wpf wrapingcode xml year





