User438798737 posted
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.
code is:
Imports Microsoft.Office.Interop
Imports Microsoft.Office.Interop.Excel
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
End Sub
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()
End Sub
End Class
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...