Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VB.NET and Excel2003 COM Object and PIA

I am using VB.Net 2003 and try to program with Office
2003 Excel. I upgraded from Office 2002 to 2003.
I installed the Office Primary Interop Assemlies
through the Office 2003 (By checking .Net Programmability
Support).In the VB.Net program, I added reference
to "Microsft Excel 11.0 Object Library". The first test
program just tries to create
Excel.Application,Excel.WorkBook,etc. (see below). It
passed the Build except the Range object. But I got run
time error at the line
Dim objWB As New Microsoft.Office.Interop.Excel.Workbook

The error mesasge is

A first chance exception of
type 'System.Runtime.InteropServices.COMException'
occurred in TestExcel.exe

Additional information: COM object with CLSID {00020819-
0000-0000-C000-000000000046} is either not valid or not
registered.

I checked the Registry, the COM object is there. I
even tried to delete the Registry Key and re-install the
Office 2003. I still got the same error at the same line.

Another problem with this Excel COM and PIA is , I
could not see the Range object in the Design view Object
dropdown box when I type
Dim objRange As New Microsoft.Office.Interop.Excel.

Is there any bug in the Excel2003 or the PIA with it??

Thank you for your input.


Carol Xie



------VB.Net Test Code.
Module TestExcel
Sub main()

Dim objWkSheet As New
Microsoft.Office.Interop.Excel.Worksheet
Dim objRolCol As New
Microsoft.Office.Interop.Excel.XlRowCol
Dim objApp As New
Microsoft.Office.Interop.Excel.Application
Dim objWB As New
Microsoft.Office.Interop.Excel.Workbook
''m objRange As New
Microsoft.Office.Interop.Excel.Range

objWB = objApp.Workbooks.Open
("C:\VBCode\TestData\Excel_Test\Test Data 1.xls")
objWkSheet = objWB.Worksheets.Item(0)
objRolCol = objWkSheet.Cells(1, 1)
MsgBox("Cell1_1:" + objRolCol.ToString())

objWB.Close()
objApp.Quit()
objRolCol = Nothing
objWkSheet = Nothing
objWB = Nothing
objApp = Nothing


End Sub



End Module
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 Label Options - Forms Object vs Control Box Object Awrex Excel Discussion (Misc queries) 3 July 17th 09 07:10 PM
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Range object to Array object conversion Myrna Larson[_2_] Excel Programming 1 August 1st 03 02:27 AM
Range object to Array object conversion Alan Beban[_3_] Excel Programming 0 August 1st 03 01:24 AM
Range object to Array object conversion Tom Ogilvy Excel Programming 0 August 1st 03 12:16 AM


All times are GMT +1. The time now is 03:48 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"