Option Strict On Disallows Late Binding -- What to do?

D

DK

This particular area of the program builds a Excel spreadsheet for the
user to manipulate further. After turning Option Strict On and
correcting everything I can the following line remains -- any ideas
how to reconstruct this so it doesn't think its a late bound object?

xlWS.Cells(row, col).value = ObjColumn.HeaderOne & " " &
ObjColumn.HeaderTwo

XLWS is defined as an Excel.Worksheet and xlWS.Cells(row,col).value
apears to be late bound -- what do I need to use in place of this?
 
C

CMM

Try to caste the Cells(...) call into the object type you expect (a Range?).
CType(xlWS.Cells(row, col), Excel.Range).value=...
Or something like that.
 
C

Cor Ligthert[MVP]

DK,

The way I would do it, was using the intelligence, as xlWS is correct then
it will give after the dot what you can use.

In other words, type it over again.

If there then is something that is not in your intelligence, then you have
to (direct)cast it, to a "type" that contain then what you are using.

Cor
 
D

DK

DK,

The way I would do it, was using the intelligence, as xlWS is correct then
it will give after the dot what you can use.

In other words, type it over again.

If there then is something that is not in your intelligence, then you have
to (direct)cast it, to a "type" that contain then what you are using.

Cor

Agreed but it looks nasty:
xlWS.Range(xlWS.Cells(row, col), xlWS.Cells(row, col)).Value =
ObjColumn.HeaderOne & " " & ObjColumn.HeaderTwo
 

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