How to click on a non-button IE object via VBA?

I'm trying to create a code that will click on an object called "List View" in an IE window.  Below are 2 examples of the code for the same object.  The object ID keeps changing.

Example# 1
<LI id=x-menu-el-ext-comp-396813 class=x-menu-list-item><A id=ext-comp-396813 class=x-menu-item hideFocus href="https://servman/sm/cwc/cwc_listdetail.jsp?thread=1#" unselectable="on"><IMG id=ext-gen65 class="x-menu-item-icon " alt="" src="https://servman/sm/js/extjs/resources/images/default/s.gif"><SPAN id=ext-gen66 class=x-menu-item-text>List View</SPAN></A></LI>

Open in new window


Example# 2
<LI id=x-menu-el-ext-comp-735337 class=x-menu-list-item><A id=ext-comp-735337 class=x-menu-item hideFocus href="https://servman/sm/cwc/cwc_listdetail.jsp?thread=1#" unselectable="on"><IMG id=ext-gen65 class="x-menu-item-icon " alt="" src="https://servman/sm/js/extjs/resources/images/default/s.gif"><SPAN id=ext-gen66 class=x-menu-item-text>List View</SPAN></A></LI>

Open in new window


My attempt
For Each Btn In objFrameDoc.getElementsByTagType("LI")
            If btn.text= " List View" Then
                btn.Click

Open in new window

kbay808Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
Hi,

pls try

Set ObjA = ie.Document.getElementByID("x-menu-el-ext-comp-6813").getElementsByTagName("A")(0)
  ObjA.Click 

Open in new window


Regards
0
kbay808Author Commented:
I'm getting a run-time error '438'.  Object doesn't support this property or method.
0
Rgonzo1971Commented:
Sorry cannot help further
0
kbay808Author Commented:
I found the solution

For Each Btn In objFrameDoc.getElementsByClassName("x-menu-item")
            If btn.ID= "ext-comp-6813" Then
            If Btn.href="https://servman/sm/cwc/cwc_listdetail.jsp:thread=25#" Then
                btn.Click

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kbay808Author Commented:
I found the solution on my own.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.