Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

method 'range' of object'_global' failed on XL sort

0 views
Skip to first unread message

ragtopcaddy via AccessMonster.com

unread,
Nov 14, 2007, 5:44:16 PM11/14/07
to
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

--
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

John Nurick

unread,
Nov 15, 2007, 2:02:50 AM11/15/07
to
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"), ...

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

ragtopcaddy via AccessMonster.com

unread,
Nov 15, 2007, 9:02:47 AM11/15/07
to
John,

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

--

0 new messages