Læsning af celler fra et Excel ark til et datagrid i VB
Hvordan kommer jeg videre idet jeg ikke kan indlæse værider fra et Excel ark til et datagrid i VB, Nedenstående problem løser ikke mit problemDeclare object variables for Microsoft Excel,
\' application workbook, and worksheet objects.
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim xlApp As Object
\' Assign object references to the variables. Use
\' Add methods to create new workbook and worksheet
\' objects.
Set xlApp = GetObject(\"C:\\Afkast sep 2001.xls\")
Set xlBook = xlApp.Workbook.Activate
Set xlSheet = xlBook.Worksheets(\"Ark1\")
\' Assign the values entered in the text boxes to
\' Microsoft Excel cells.
\' Text1.Text = xlApp.Workbooks.Worksheets.Cells(1, 1).Value
\' Close the Workbook
xlBook.Close
\' Close Microsoft Excel with the Quit method.
xlApp.Quit
\' Release the objects.
Set xlApp = Nothing
Set xlBook = Nothing
Set xlSheet = Nothing