Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Add Unique item to Collection

I was pretty sure I knew how collections worked, but why do I get a run time
error (457) with this macro? Doesn't the On Error Resume Next trap that
error? XL2000, Win98SE.

Sub test()

Dim theColl As New Collection

theColl.Add "me", "me"
On Error Resume Next
theColl.Add "me", "me"
On Error GoTo 0

End Sub

Thanks.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Add Unique item to Collection

Dick
It works for me in XL2002 without an error.
Regards,]
Jim Cone
San Francisco, CA

"Dick Kusleika" wrote in message
...
I was pretty sure I knew how collections worked, but why do I get a run time
error (457) with this macro? Doesn't the On Error Resume Next trap that
error? XL2000, Win98SE.
Sub test()
Dim theColl As New Collection
theColl.Add "me", "me"
On Error Resume Next
theColl.Add "me", "me"
On Error GoTo 0
End Sub
Thanks.
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Add Unique item to Collection

Dick,

I don't get that error, it steps through nicely. XL2000, XP.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Dick Kusleika" wrote in message
...
I was pretty sure I knew how collections worked, but why do I get a run

time
error (457) with this macro? Doesn't the On Error Resume Next trap that
error? XL2000, Win98SE.

Sub test()

Dim theColl As New Collection

theColl.Add "me", "me"
On Error Resume Next
theColl.Add "me", "me"
On Error GoTo 0

End Sub

Thanks.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Add Unique item to Collection

Jim

Thanks for checking. I don't remember any problems with collection in 2000,
but maybe there is. BTW, I tested it in XL97 and had no problem.

Dick

"Jim Cone" wrote in message
...
Dick
It works for me in XL2002 without an error.
Regards,]
Jim Cone
San Francisco, CA

"Dick Kusleika" wrote in message
...
I was pretty sure I knew how collections worked, but why do I get a run

time
error (457) with this macro? Doesn't the On Error Resume Next trap that
error? XL2000, Win98SE.
Sub test()
Dim theColl As New Collection
theColl.Add "me", "me"
On Error Resume Next
theColl.Add "me", "me"
On Error GoTo 0
End Sub
Thanks.
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Add Unique item to Collection

Hi dick

No error for me in XL 2000,WinXP

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Dick Kusleika" wrote in message ...
I was pretty sure I knew how collections worked, but why do I get a run time
error (457) with this macro? Doesn't the On Error Resume Next trap that
error? XL2000, Win98SE.

Sub test()

Dim theColl As New Collection

theColl.Add "me", "me"
On Error Resume Next
theColl.Add "me", "me"
On Error GoTo 0

End Sub

Thanks.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Add Unique item to Collection

Thanks Bob and Ron.

I don't know what the heck's going on here. I regserver'ed, code cleaned
and rebooted all to no avail. That's the extent of my troubleshooting
skills, so I'll be using a workaround until I can start messing with it.

Dick

"Ron de Bruin" wrote in message
...
Hi dick

No error for me in XL 2000,WinXP

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Dick Kusleika" wrote in message

...
I was pretty sure I knew how collections worked, but why do I get a run

time
error (457) with this macro? Doesn't the On Error Resume Next trap that
error? XL2000, Win98SE.

Sub test()

Dim theColl As New Collection

theColl.Add "me", "me"
On Error Resume Next
theColl.Add "me", "me"
On Error GoTo 0

End Sub

Thanks.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Add Unique item to Collection

Send me your test workbook if you want Dick.
I can test it again for you

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Dick Kusleika" wrote in message ...
Thanks Bob and Ron.

I don't know what the heck's going on here. I regserver'ed, code cleaned
and rebooted all to no avail. That's the extent of my troubleshooting
skills, so I'll be using a workaround until I can start messing with it.

Dick

"Ron de Bruin" wrote in message
...
Hi dick

No error for me in XL 2000,WinXP

--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"Dick Kusleika" wrote in message

...
I was pretty sure I knew how collections worked, but why do I get a run

time
error (457) with this macro? Doesn't the On Error Resume Next trap that
error? XL2000, Win98SE.

Sub test()

Dim theColl As New Collection

theColl.Add "me", "me"
On Error Resume Next
theColl.Add "me", "me"
On Error GoTo 0

End Sub

Thanks.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.








  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Add Unique item to Collection

Hi Dick,

Sounds like you have the 'Break on all Errors' option set.
Check your VBE options, Error trapping is on the General tab.

Try one of the other 2 options.

Dick Kusleika wrote:

I was pretty sure I knew how collections worked, but why do I get a run time
error (457) with this macro? Doesn't the On Error Resume Next trap that
error? XL2000, Win98SE.

Sub test()

Dim theColl As New Collection

theColl.Add "me", "me"
On Error Resume Next
theColl.Add "me", "me"
On Error GoTo 0

End Sub

Thanks.


--

Cheers
Andy

http://www.andypope.info

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 599
Default Add Unique item to Collection

Andy

Yep, that was it. I wonder how that got changed? I choose to believe that
it was a malicious virus instead of my own carelessness. Thanks.

Dick

"Andy Pope" wrote in message
...
Hi Dick,

Sounds like you have the 'Break on all Errors' option set.
Check your VBE options, Error trapping is on the General tab.

Try one of the other 2 options.

Dick Kusleika wrote:

I was pretty sure I knew how collections worked, but why do I get a run

time
error (457) with this macro? Doesn't the On Error Resume Next trap that
error? XL2000, Win98SE.

Sub test()

Dim theColl As New Collection

theColl.Add "me", "me"
On Error Resume Next
theColl.Add "me", "me"
On Error GoTo 0

End Sub

Thanks.


--

Cheers
Andy

http://www.andypope.info



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
To find rate of each item from item.xls and to copy price.xls pol Excel Discussion (Misc queries) 7 July 16th 09 12:49 AM
unique item remover doc Excel Discussion (Misc queries) 1 November 13th 07 06:49 PM
Adding Unique Items to a Collection WJ Excel Discussion (Misc queries) 2 June 12th 07 03:46 PM
Item numbers result in item description in next field in Excel Cheryl MM Excel Worksheet Functions 1 February 20th 07 03:51 PM
Removing an Item From a Collection Dan Gesshel Excel Programming 4 November 1st 03 01:12 PM


All times are GMT +1. The time now is 11:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"