MKP Posted January 25, 2003 Posted January 25, 2003 How to read cell(1,1) and cell(1,2) from an excel workbook (c:/add.xls); worksheet (sheet1) and add the two numbers and display output in excel sheet (sheet 2 of c:/add.xls) cell(1,1)? Quote
Madz Posted January 26, 2003 Posted January 26, 2003 Try Using Microsoft EXCEL Object in your application. on MSDN Library site there is a complete list of EXCEL Object and their properties. Quote The one and only Dr. Madz eee-m@il
Gizmo001 Posted January 28, 2003 Posted January 28, 2003 Use the following line to open an Excel application: Dim Xl As New Excel.Application() Use the following line to open an Excel file (abc.xls) Dim Xlb As Excel.Workbook = Xl.Workbooks.Open(abc.xls) Use the following line to connect to Sheet1: Dim Xls As Excel.Worksheet = CType(Xlb.Worksheets(1), Excel.Worksheet) Use the following line to connect to Sheet2: Dim Xlsa As Excel.Worksheet = CType(Xlb.Worksheets(2), Excel.Worksheet) Use the following line to copy from Sheet1: A1 to Sheet2: A2 xlsa.cells(1,1).value=xls.cells(1,1).value Hope this helps. Don't forget to close files and application. Good luck. Quote
cerr Posted January 29, 2003 Posted January 29, 2003 Gizmo- Can u show the proper way to close the file and application in your example? Thxs! Quote
Gizmo001 Posted January 30, 2003 Posted January 30, 2003 For the example I gave earlier, you can use the following to close the file, quit application, and free objects. Xlb.Close(False) Xl.Application.Quit() Xl = Nothing Xlb = Nothing Xls = Nothing Xlsa=Nothing Good Luck. Quote
Vanessa83 Posted September 30, 2009 Posted September 30, 2009 I figured i should do the same as the previous postee, so i have added the mircosoft excel object....but how do i actually get the spreadsheets? Its not under the toolbox....:S Quote
Recommended Posts