0

From the posts in this website I see how to open an Excel spreadsheet from VB 5.0 but I don't see any examples of moving data (not an array) from vb to excel.
Can anyone show me an example?
Do you know of any books that would have this information?
Thanks

3
Contributors
5
Replies
6
Views
10 Years
Discussion Span
Last Post by QVeen72
0

Hi,
Check this code:

Dim xlsheet As Excel.Worksheet
 
TO READ FROM EXCEL
   Text1.Text = xlsheet.Cells(2, 1) 
   Text2.Text = xlsheet.Cells(2, 2) 
   '
TO WRITE INTO EXCEL
   '
   xlsheet.Cells(2, 1) = Text1.Text
   xlsheet.Cells(2, 2) = Text2.Text

Regards
Veena

0

Thanks. I'm using vb 5.0 so I don't know if I could use that method. I tries Veena's tip and got it to work. Thanks

0

Thanks, Veena. That did the trick. Could you tell me how i can concatenate 2 vb fields into 1 excel cell?
Thanks

0

Hi,

u can concatenate 2 fields using "&" this way :

xlsheet.Cells(1, 1) = Text1.Text & ";" & Text2.Text
You can or Cannot use any De-Limiter in Between.
 
Or (No De-Limiter)
 
xlsheet.Cells(1, 1) = Text1.Text & Text2.Text

I Hope it is clear. :lol:

Regards
Veena

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.