Hi Tim,

Hope this helps.

---------- Forwarded message ----------
From: Ron Parker <[EMAIL PROTECTED]>
Date: Wed, 13 Aug 2008 08:04:47 -0400
Subject: Re: Finding a window by control id
To: [email protected]

Sean Farrow wrote:
> Hi:
> I needto find a window y it's control id, do I have to loop through all
> window objects in the activewindow.children collection or is there
> aFindContolId method I've missed, if there isn't could one be added to
> the windows collection?
>

Window.Control takes an optional parameter.  So, for example, if you
have a dialog window in a variable called wndDialog, and you want the
control with an ID of 1001, you can do

wndDialog.Control( 1001 )

> Also could w have a controls collection to allow looping through
> controls in somethin like the active window.
>

The controls in a window are the same as its children, for the most
part.  Just go through the Window.DirectChildren collection.  For each
child window that has Window.Style.Child true, you can turn it into a
control by getting Window.Control (without the ID parameter)


For Each wndCtrl in wndDialog.DirectChildren
    If wndCtrl.Style.Child
        set ctrl = wndCtrl.Control
        ' Do Stuff With ctrl Here.
    End If
Next

Reply via email to