vba + html - accessing tab on website not working

mike12345

New Member
Joined
Oct 25, 2011
Messages
3
Hello all,

When Im in the site, there are 2 tabs - wathlists and quotelists. Quotelists is the default. When I put the simple link to watchlists it pops up and then ends up jumping back to the main page:

objIE.navigate "https://www...

I have also tried clicking the tab but Im still new to this and want to understand why this is not working. Ive done this before with other sites.
Code:
x = objIE.document.getElementsByClassName("selected")
     x.Click
Have also tried class name with tabBorder



HTML:
<div class="mainTabs"><a class="selected" href="../quotelist/quotelist.asp"><div>Quote Lists</div></a><a class="notSelected" href="../watchlist/watchlist.asp"><div>Watch Lists</div></a>  <div class="tabBorder"></div></div>		<a class="selected" href="../quotelist/quotelist.asp"><div>Quote Lists</div></a>		<a class="notSelected" href="../watchlist/watchlist.asp"><div>Watch Lists</div></a>			<div>Watch Lists</div>		</a>		<div class="tabBorder"></div>		</div>


Can anyone suggest a fix to this. I think I'm not even clicking the button and believe I need to unselect quotelists???

Many thanks
Mike
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hello Worf,

Unfortunately no since its my trading account. Canthese secure sites be interacted with? What code would you need in the site? Ihave tried to enter text into a box on the website and couldn't do it either. Please see code below including trying toclikc add button
Code:
   '<input name="sym" class="text" id="textIn" type="text" value="Enter Symbol">
  objIE.document.all.Item("textIn").Value = "rew"
  objIE.document.getElementsByClassName("text").Value = "cgc"
  objIE.document.getElementById("textIn").Value = "cgc"
  objIE.document.getElementsByTagName("sym").Value = username
 '***********************************
    '<button id="addButton">Add Symbol</button>
  Set x = objIE.document.getElementById("addContainer").getElementsByTagName("button")
  x.Click
    Set x = objIE.document.getElementById("addContainer")
     x.Click
    For Each l In ie.document.getElementsByTagName("button")
    If l.className = "addButton" Then
        l.Click
        Exit For
    End If
    Next
    
 '<a class="link_s normal refresh-link" id="refreshLink" href="stockslist.asp" data-url="stockslist.asp">Refresh List</a>
     Application.Wait (Now + TimeValue("0:00:08"))
    Set x = objIE.document.getElementById("refreshLink")
    x.Click

Any helpappreciated
Thank you
Mike

 
Upvote 0
This example works:

ZyfW9m5.png


Code:
Sub WForm()
Dim ie As Object, ftb, stb
On Error GoTo 0
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = 1
ie.navigate "https://www.youtube.com/"
While ie.busy
    DoEvents
Wend
Set ftb = ie.Document.getElementById("masthead-search-term")    ' text box
ftb.Value = "star trek discovery"
Set stb = ie.Document.getElementById("search-btn")              ' button
stb.Click
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,822
Messages
6,181,165
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top