How can I use Excel 2003 Spreadsheet Component in Visual Basic 2005?

S

sfsepehr

Hi all,

I'm new to Visual Basic 2005, but experienced in VB6. I use an Excel
spreadsheet in my program (that is OWC11). In VB6 I used to intract
with the spreadsheet like:

A(i , j) = frmSample.xlsSample.Cells(i , j).Value

& I could get the value in cell (i , j),. but now it doesn't work. Can
anybody help me regarding this mater?
 
S

sfsepehr

Thanks Alvin. Actually I've found the solution by changing my code as:

Dim _Cell as OWC11.Range

_Cell=frmSample.xlsSample.Activesheet.Cells(i , j)
A(i , j)=_Cell.Value

& it fortunately works (using the "Activesheet" property). But now I've
got another probelm with multysheet spreadsheets. In VB6 I used to code
as

A(i, j)=frmSample.Sheet(2).Cells(i,j).Value

or

A(i,j)=frmSample.Sheet("Sheet2").Cells(i,j).Value

for example, but now in VB2005 even rewriting it as

Dim _sheet as OWC11.Sheets, _Cell as OWC11.Range

_Sheet=frmSample.Sheet("Sheet2" or 2)
_Cell=_Sheet.Cells(i,j)
A(i,j)=_Cell.Value

Doesn't work at all. I mean it yields to an error. I can delete current
sheet (Sheet1) or add another sheet, but I can't even rename the sheets
in VB2005 & interact with their cells values.

& please be sure Alvin thay of course I've got data in those cells.

Again Thanks for your reply.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top