Tom,

It passes the IsValid test and then gives me the error that an object is
needed. Thanks for the help, though.

Vic


-----Original Message-----
From: Tom Kingston [mailto:[email protected]] 
Sent: Saturday, March 06, 2010 4:21 AM
To: [email protected]
Subject: Re: Clearing a collection of clips

I'd have to see more to see what's going on, but be it that you're declaring

those clips within a sub they'll be destroyed every time you exit that sub 
and recreated every time it's called. So they wouldn't maintain a count of 
one. Off the top of my tired head the only other thing I can think of is 
that you're grabbing them as the window changes. Maybe I'll see something 
else in the morning when I'm conscious, but for now, here's my only 
suggestion.

If C.Count > 0 And D.Count > 0 Then
  If C(1).IsValid And D(1).IsValid then
    Speak "Joy to the world!"
  Else
    Speak "Good night."
end If
' End day

Hth,
Tom


----- Original Message ----- 
From: "Vic Beckley" <[email protected]>
To: <[email protected]>
Sent: Friday, March 05, 2010 5:14 PM
Subject: Clearing a collection of clips


> Hi all,
>
>
>
> I am using the following sub to find certain clips when they exist on the
> screen.
>
>
>
> Sub timeInfo()
>
> If ActiveWindow.ModuleName = "EZCDDAX" Then
>
> Dim C, D
>
> Set C = ActiveWindow.Clips.SearchText("Used:")
>
> Set D = ActiveWindow.Clips.SearchText("Available:")
>
> If C.Count > 0 And D.Count > 0 Then
>
> Speak c(1).Line.ClipsText
>
> Speak D(1).Line.ClipsText
>
> Mouse.Position = D(1).Position.ScreenPoint
>
> Else
>
> Speak "Statistics not found"
>
> End If
>
> End If
>
> End Sub
>
>
>
> The problem is that when I am on a screen where the searched for clips do
> not exist and I have found them previously I get an error that C(1) does 
> not
> exist. How do I set the collection variables, C and D, back to having a
> count of 0. Once the clips are found, they always have a count of 1.
>
>
>
> Please help.
>
>
>
> Vic
>
>
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus 
> signature database 4919 (20100305) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
> 


__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4919 (20100305) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




Reply via email to