•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 402,624 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,140 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 12289 | Replies: 1
![]() |
•
•
Join Date: Oct 2005
Posts: 1
Reputation:
Rep Power: 0
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:
Rep Power: 0
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb VB.NET Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- 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: network programming
- Next Thread: I am needing a control array, but VB.NET doesn't support them...


Linear Mode