I get it off and on with this line:
With objXL
(lots of other code...)
.ActiveSheet.Range("A1:AO" & iRow).Select
'Here's where I get the error:
.Selection.Sort Key1:=Range("AK2"), Order1:=xlAscending, Header:= _
xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:
=xlTopToBottom, _
DataOption1:=xlSortNormal
End With
I have also seen another strange error with something like "RPL" in it's text
at the same point in my code.
Thanks,
Bill R
--
Bill Reed
"If you can't laugh at yourself, laugh at somebody else"
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/200711/1
On Wed, 14 Nov 2007 22:44:16 GMT, "ragtopcaddy via AccessMonster.com"
<u9289@uwe> wrote:
>I am getting the error msg "method 'range' of object'_global' failed "
>sporadically in my code. I read elsewhere not to use "With ObjXL", but
>there's no explanation of why.
>
>I get it off and on with this line:
>
> With objXL
> (lots of other code...)
> .ActiveSheet.Range("A1:AO" & iRow).Select
> 'Here's where I get the error:
> .Selection.Sort Key1:=Range("AK2"), Order1:=xlAscending, Header:= _
> xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:
>=xlTopToBottom, _
> DataOption1:=xlSortNormal
> End With
>
>I have also seen another strange error with something like "RPL" in it's text
>at the same point in my code.
>
>Thanks,
>
>Bill R
--
John Nurick - Access MVP
Thanks for the suggestion. It sounds like that might be the problem. I'll try
it this afternoon.
Thanks,
Bill Reed
John Nurick wrote:
>You need to qualify the call to the Range method with the object on
>which you want to invoke the method. Maybe
> .Selection.Sort Key1:= .ActiveSheet.Range("AK2"), ...
>
>>I am getting the error msg "method 'range' of object'_global' failed "
>>sporadically in my code. I read elsewhere not to use "With ObjXL", but
>[quoted text clipped - 18 lines]
>>
>>Bill R
>--
>John Nurick - Access MVP
--