Last post Apr 20, 2009 08:33 AM by gsheetal
Apr 20, 2009 02:23 AM|gsheetal|LINK
i have created a windows application, in which i am using an excel sheet for some calculations.
when i build the application i am getting the following error.
error: type Microsoft.Office.Interop.Excel.Application is not defined.
Public Class RA
Dim excel As Microsoft.Office.Interop.Excel.Application
Dim workBook As Microsoft.Office.Interop.Excel.Workbook
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
excel = New Microsoft.Office.Interop.Excel.Application
workBook = excel.Workbooks.Open("d:\\aa.xls")
Excel.Visible = True
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'CHECK FOR AREA ADEQUACY BASED ON INPUTS
Dim workSheet As Microsoft.Office.Interop.Excel.Worksheet
'ASSIGN THE WORKSHEET TO THE REQUIRED ONE.
workSheet = workBook.Worksheets("Sheet1")
'ASSIGN THE INPUT TEXTBOXES VALUES TO RESPECTIVE EXCEL SHEET CELLS.
workSheet.Cells(2, 1) = TextBox1.Text
'GET THE OUTPUT CELL VALUES FROM THE EXCEL SHEET INTO THE OUTPUT TEXTBOXES.
TextBox2.Text = DirectCast(workSheet.Cells(2, 2), Excel.Range).Value2.ToString()
also i m not getting office as an option when i write import microsoft. but others are available - sqlserver,visualbasic and win32
Please Help me in this...
Apr 20, 2009 04:36 AM|vijayvrr_2001|LINK
(1) You must have office installed on that machine for this code to work. I presume thats the case. Office dlls are exposed via COM dll files. In add reference under COM tab, you must be able to find them. look for something like "Microsoft Office 12.0
Object Library" or "Microsoft.Word.* dll".
Once the reference to the above file is added, you must see a Interop.Office Or interop.Word.dll coming up. After this your code should execute.
Hope that helps
Apr 20, 2009 08:33 AM|gsheetal|LINK
i have office 2003 installed in my system.
i m refering in COM tab to "Microsoft Office 11.0 Object Library"
As i investigated there is no Microsoft.Office.Interop.Excel.dll present in the asembly folder of my system.
i downloaded and added the same still the same error occurs.