How to read excel sheet in Visual basic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • uprakash14
    New Member
    • Mar 2007
    • 12

    How to read excel sheet in Visual basic

    i Want to read excel sheet data in visula basic ... for manipulation of data.. plz give me the code .. for this..
  • ansumansahu
    New Member
    • Mar 2007
    • 149

    #2
    Originally posted by uprakash14
    i Want to read excel sheet data in visula basic ... for manipulation of data.. plz give me the code .. for this..

    Hi ,

    Try this out

    Dim xlsApp As Excel.Applicati on = New Excel.Applicati on
    xlsApp.DisplayA lerts = False
    xlsApp.Workbook s.Open("c:\myXl sFile.xls")
    Dim xlSht As Excel.Worksheet = xlsApp.Sheets(1 )
    Dim xlRng As Excel.Range = xlSht.Cells(1, 1)
    Textbox1.Text = xlRng.Value

    thanks
    ansuman sahu

    Comment

    • uprakash14
      New Member
      • Mar 2007
      • 12

      #3
      thanx anshu..
      but i want to full code for extracting excel sheet in Visual basic
      plz help for this

      Comment

      • csenasa
        New Member
        • Sep 2007
        • 10

        #4
        excel sheet kyaa hotha hai yaar??

        Comment

        • QVeen72
          Recognized Expert Top Contributor
          • Oct 2006
          • 1445

          #5
          Originally posted by uprakash14
          thanx anshu..
          but i want to full code for extracting excel sheet in Visual basic
          plz help for this
          HI,

          FULL CODE..?
          Open like in Anshu's Code , and Loop thru the cells, and populate a Grid...

          [code=vb]
          For i= 1 To 100
          Grd.TextMatrix( i,1) = xlSht.Cells(1, 1)
          Grd.TextMatrix( i,2) = xlSht.Cells(1, 2)
          Grd.TextMatrix( i,3) = xlSht.Cells(1, 3)
          Grd.TextMatrix( i,4) = xlSht.Cells(1, 4)
          Next i
          [/code]

          Regards
          Veena

          Comment

          Working...