Re: Programmatically selecting an element
From: Charles Law (blank_at_nowhere.com)
Date: 03/24/04
- Next message: Igor Tandetnik: "Re: Open IWebBrowser via vbscript?"
- Previous message: The: "Programmatically selecting an element"
- In reply to: The: "Programmatically selecting an element"
- Next in thread: MarkC: "Re: Programmatically selecting an element"
- Reply: MarkC: "Re: Programmatically selecting an element"
- Messages sorted by: [ date ] [ thread ]
Date: Wed, 24 Mar 2004 09:31:51 -0000
Hi Mark
Try the following, passing in a reference to the document and the element to
be selected.
<code>
Private Sub SelectElement(ByVal doc2 As mshtml.IHTMLDocument2, ByVal el As
mshtml.IHTMLElement)
Dim el2 As mshtml.IHTMLElement2
Dim ctlRg As mshtml.IHTMLControlRange
If TypeOf el Is mshtml.IHTMLControlElement Then
el2 = DirectCast(doc2.body, mshtml.IHTMLElement2)
ctlRg = DirectCast(el2.createControlRange(),
mshtml.IHTMLControlRange)
ctlRg.add(DirectCast(el, mshtml.IHTMLControlElement))
ctlRg.select()
End If
End Sub
</code>
HTH
Charles
"The" <Mark@Microsoftnewsgroups.com> wrote in message
news:%23GZJ6aWEEHA.1376@TK2MSFTNGP10.phx.gbl...
> Hi all.
>
> I asked this question some time back but was unsuccessful in getting an
> answer, so perhaps it's not as obvious as I assumed.
>
> In MSHTML edit mode I'd like to be able to select a specific element in
the
> layout. I thought there would be some way via IHTMLElement, but none of
the
> expected operations - such as click() - work. Currently I'm doing a hack
> using TAB messages, but I'm sure there's some standard way of directly
> selecting (that is, so the item has handles etc).
>
> Perhaps it's a standard OLE thing that's not documented in MSHTML
> interfaces.
>
> Any info greatly appreciated.
>
> MarkC
>
>
- Next message: Igor Tandetnik: "Re: Open IWebBrowser via vbscript?"
- Previous message: The: "Programmatically selecting an element"
- In reply to: The: "Programmatically selecting an element"
- Next in thread: MarkC: "Re: Programmatically selecting an element"
- Reply: MarkC: "Re: Programmatically selecting an element"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|