By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,098 Members | 1,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,098 IT Pros & Developers. It's quick & easy.

How to read excel sheet in Visual basic

P: 12
i Want to read excel sheet data in visula basic ... for manipulation of data.. plz give me the code .. for this..
Mar 28 '07 #1
Share this Question
Share on Google+
4 Replies


100+
P: 149
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.Application = New Excel.Application
xlsApp.DisplayAlerts = False
xlsApp.Workbooks.Open("c:\myXlsFile.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
Mar 28 '07 #2

P: 12
thanx anshu..
but i want to full code for extracting excel sheet in Visual basic
plz help for this
Mar 28 '07 #3

P: 10
excel sheet kyaa hotha hai yaar??
Sep 13 '07 #4

QVeen72
Expert 100+
P: 1,445
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...

Expand|Select|Wrap|Line Numbers
  1. For i= 1 To 100
  2.   Grd.TextMatrix(i,1) = xlSht.Cells(1, 1)
  3.   Grd.TextMatrix(i,2) = xlSht.Cells(1, 2)
  4.   Grd.TextMatrix(i,3) = xlSht.Cells(1, 3)
  5.   Grd.TextMatrix(i,4) = xlSht.Cells(1, 4)
  6. Next i
  7.  
Regards
Veena
Sep 13 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.