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

Re: vb 5.0 to excel 80 80

You should study this MSDN article. I think it includes some example too.

[edit]Just noticed the link is for VB .NET, not VB 6. This might give you a start. I'm sure there are many examples. [/edit]

Re: vb 5.0 to excel 80 80

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

Re: vb 5.0 to excel 80 80

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

Re: vb 5.0 to excel 80 80

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

Re: vb 5.0 to excel 80 80

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.