[VB6] Read Excel Files


Deskripsi
     To read data cell in Excel files.

Howto
   Dim oexcel As Object
   Dim obook As Object
   Dim osheet As Object
   Dim var As Variant

   Set oexcel = CreateObject("Excel.Application")
   Set obook = oexcel.workbooks.Open("D:\Developer\sample.xlsx")
   Set osheet = obook.worksheets(1)

   ' you can read with two method, just uncomment below
   ' var = osheet.Range("A1").Value
   'or
   'var = osheet.Cells(1, 1).Value 'Row , Column

   MsgBox var
   Set osheet = Nothing
   obook.Close
   oexcel.Quit

Post a Comment

Harap gunakan bahasa yang baik dan sopan, terima kasih