Method selection of object _Global falied

  • Thread starter Thread starter Leon
  • Start date Start date
L

Leon

I'm working at VB code
With oWorkSheet
.Range(oWorkSheet.Cells(i, 1), oWorkSheet.Cells(i,MyRange)).Select
With Selection <-- and in this place I obtain error

Method selection of object _Global falied

I declare objects such as oExcel, oWorkBook, oWorkSheet as Object
and then i set'em to appropriate Excel objects.

That kind of behavior I get only in W2K + A2K + E97 enviroment
In WXP + A2K + E2K everything goes ok! :|

Can anyone help me ;)

Thanx in advice, Leon!
 
I don't speak VB, but how about:

with oExcel.selection

But even better, why not:
with .range(oWorkSheet.Cells(i, 1), oWorkSheet.Cells(i,MyRange))

And drop the selection completely.
 
Leon,

Does MyRange resolve to a Range or an Integer?
For this to work, it should resolve to an Integer.
..Cells(4,7) NOT .Cells(4,"A3:D9")

HTH
Henry
 
Back
Top