Can't autoclick icon link within a frame VBA

BHS24

New Member
Joined
May 15, 2013
Messages
2
Something's wrong with my old thread, reposted a new thread here.

Hi,
I'm trying to write a vba code: Once auto login user and password to a financial website, auto clicks on an image link on the following page. I got the auto login user and password part done but I'm stuck on writing the auto clicking on an image link part. Please help thanks.
I've tried right clicking on the icon link and shows the url, and navigate to that webpage once logged in however it automatically redirects to another page.

URL address: https://trading.poems.com.hk/poems2/poems.asp?func=view

Redirect page: https://trading.poems.com.hk/poems2/loginaction.asp



  • Frame collection:

"<html>
<head>
<title>Phillip Securities (HK)-?????? (?????????)</title>
<link rel="shortcut icon" href="images/phillip.ico">
****** http-equiv="Content-Type" content="text/html; charset=big5"></head>
<frameset cols="*, 100%" border=0 frameborder=0 framespacing=0 marginheight=0 marginwidth=0>
<frame src="Poems2/BrowserChecking.asp" name="ChkBrowser">
<frame src="Poems2/Poems.asp" name="login" frameborder=0 framespacing=0 marginheight=0 marginwidth=0>
</frameset><noframes></noframes>
</html>"

Note: I believe this "<frame src="Poems2/BrowserChecking.asp" name="ChkBrowser">" is the frame the icon link belongs in.



  • This is the HTML for the icon link I'm trying to autoclick.

"<a href="#" *******="StockPop = ************('http://www.poems.com.hk/stockSummary/stockSummary.asp?iKey=275576635353574373b375a375c05','StockAnalytics','scrollbars=yes,resizable=yes,status=yes,left=0,top=0,width=1250,height=700,toolbar=0')"><img src="images/Corner/EN/Company.png" border=0 title="Stock Analytics "></a>"



  • My vba code once logged in:
Sub open3()
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate "https://trading.poems.com.hk/poems2/poems.asp?func=view"

Do Until ie.readyState = 4
DoEvents
Loop

For Each ele In ie.document.getElementsByTagName("a")
If InStr(ele.innerHTML, "images/Corner/EN/Company.png") > 0 Then
ele.Click
Exit For
End If
Next
End Sub


  • Parts of the HTML source code of the logged in website:

"<!DOCTYPE html PUBLIC "-/W3C//DTD XHTML 1.0 Transtitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
****** http-equiv="Content-Type" content="text/html; charset=big5" />
<title>??????-?????????</title>
</head>
<link href="css/phillip.css" rel="stylesheet" type="text/css" />
******** type="text/javascript" >document.domain="poems.com.hk"*********>
******** type="text/javascript" src="js/jquery.min.js">*********>
<link rel="stylesheet" type="text/css" href="css/ddsmoothmenu_Execution_EN.css" />
******** type='text/javascript' src='js/ddsmoothmenu.js'>*********>
******** type="text/javascript" src="js/font.js">*********>
******** type="text/javascript">
ddsmoothmenu.init({
mainmenuid: "smoothmenu1", //menu DIV id
orientation: 'h', //Horizontal or vertical menu: Set to "h" or "v"
classname: 'ddsmoothmenu', //class added to menu's outer DIV
//customtheme: ["#1c5a80", "#18374a"],
contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
})

*********>
******** type="text/javascript">
var myclose = false;
function ConfirmClose()
{
frameURL = (parent.DetailFrame.location.href).toUpperCase()
//alert(frameURL + "//// " + frameURL.indexOf("PPSHK.COM"))
if (frameURL.indexOf("PPSHK") > 0)
{
if (event.clientY < 0)
{
event.returnValue = '???????????, ?????????\n????!';
//setTimeout('myclose=false',10000);
//myclose=true;
}
}
}
function parentExists() {
return (parent.location == ****************) ? false : true;
}
if(!parentExists())
****************** = "../index2.htm"

function checkKeyCode(evt)
{
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if(event.keyCode==116)
{
location.reload(true);
return false
}
}
document.onkeydown=checkKeyCode;
*********>
<body onUnload="CloseAllPop()">
********>
var EFuturePop
var StockPop
var USStockPop
var SGStockPop
var JPStockPop
var SAStockPop
var SOptionPop
var SNOptionPop
var StockGTCPop
var BullionPop
var FxBannerPop
var FoFuturePop
var ForexPop
var FoOptionsPop
var ForexResponse
var FoFutureResponse
var FoOptionsResponse
function CloseAllPop(){
if(EFuturePop != null){
EFuturePop.close()
}
if(StockPop != null){
StockPop.close()
}
if(USStockPop != null){
USStockPop.close()
}
if(SGStockPop != null){
SGStockPop.close()
}
if(JPStockPop != null){
JPStockPop.close()
}
if(SAStockPop != null){
SAStockPop.close()
}
if(SOptionPop != null){
SOptionPop.close()
}
if(SNOptionPop != null){
SNOptionPop.close()
}
if(StockGTCPop != null){
StockGTCPop.close()
}
if(BullionPop != null){
BullionPop.close()
}
// if(FxBannerPop != null){
// FxBannerPop.close()
// }
if(FoFuturePop != null){
FoFuturePop.close()
}
if(ForexPop != null){
ForexPop.close()
}
if (FoOptionsPop != null) {
FoOptionsPop.close()
}
}
function forexClose(ans){
ForexResponse = ans;
}
function foFutureClose(ans){
FoFutureResponse = ans;
}
function foOptionsClose(ans) {
FoOptionsResponse = ans;
}
function DisclaimerClose(type,ans){
if (type == "Forex"){
ForexResponse = ans;
}
else if (type == "FoFuture"){
FoFutureResponse = ans;
}
else if (type == "FoOptions") {
FoOptionsResponse = ans;
}
}

function changeDetailFrame(link) {
$('#DetailFrame').attr('src',link);
}
function CheckStockGTCPop(){
if(StockGTCPop != null){
parent.DetailFrame.location.href = "NoPopup/ZH/TradeStock_GTC.asp"
}
else{
StockGTCPop = ************('StockDisclaimer_GTC.asp','HKStockGTC','scrollbars=yes,resizable=yes,status=no,left=0,top=0,width=1014,height=710,toolbar=0')
}
}
function CheckForexPop(){
if (ForexResponse=="A"){
if (ForexPop.closed) {
ForexPop = ************('Forex/asp/menu/100kforex_fr.asp','Forex','scrollbars=yes,resizable=yes,status=no,left=0,top=0,width=1014,height=710,toolbar=0')
}
}
else{
ForexPop = ************('ForexDisclaimer.asp','Forex','scrollbars=yes,resizable=yes,status=no,left=0,top=0,width=1014,height=710,toolbar=0')
}
}
function CheckFoFuturePop(){
if (FoFutureResponse=="A"){
if (FoFuturePop.closed){
FoFuturePop = ************('FoFutures/EN/ftslingshot2b3/LiveMain_fr.asp?type=F', 'FoFuture', 'scrollbars=yes,resizable=yes,status=no,left=0,top=0,width=1014,height=710,toolbar=0')
}
}
else{
FoFuturePop = ************('FoFutureDisclaimer.asp','FoFuture','scrollbars=yes,resizable=yes,status=no,left=0,top=0,width=1014,height=710,toolbar=0')
}
}
function CheckFoOptionsPop() {
if (FoOptionsResponse == "A") {
if (FoOptionsPop.closed) {
FoOptionsPop = ************('FoFutures/EN/ftslingshot2b3/LiveMain_fr.asp?type=O', 'FoFuture', 'scrollbars=yes,resizable=yes,status=no,left=0,top=0,width=1014,height=710,toolbar=0')
}
}
else {
FoOptionsPop = ************('FoOptionsDisclaimer.asp','FoOptions', 'scrollbars=yes,resizable=yes,status=no,left=0,top=0,width=1014,height=710,toolbar=0')
}
}
// function CheckFoFuturePop_FO(){
// FoFuturePop = ************('FoFutures/EN/ftslingshot2b3/LiveMain_fr_FO.asp','FoFuture','scrollbars=yes,resizable=yes,status=no,left=0,top=0,width=1014,height=710,toolbar=0')
// }
function CheckFxBannerPop(){
if(FxBannerPop != null){
parent.DetailFrame.location.href = "Forex/asp/menu/100kforex_fr.asp"
}
else{
parent.DetailFrame.location.href = "Forex/asp/menu/100kforex_fr.asp"
FxBannerPop = ************('Banner.htm','FxBanner','scrollbars=yes,resizable=yes,status=no,left=0,top=0,width=600,height=300,toolbar=0')
}
}
//document.body.onunload = CloseAllPop
*********>
<table width="985" border="0" align="center" cellpadding="0" cellspacing="0" id="maintable">
<tr>
<td width="10" background="images/bgsquareleft.jpg"></td>
<td bgcolor="#FFFFFF"><table width="940" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="64"><a href="MainMenu.asp" target="DetailFrame"><img src="POEMSBanner.gif" alt="Phillip's ON-LINE ELECTRONIC MART SYSTEM" height="54" border="0" /></a></td>
<td align="right" valign="bottom" class="style3">
<a href="#" *******="TradCenPop = ************('https://trading.poems.com.hk/Poems2/tradingcentral/index.aspx?pf=X&lang=en&id=X8594568','TradingCentral','scrollbars=yes,resizable=yes,status=yes,left=0,top=0,width=680,height=480,toolbar=0')"><img src="images/Corner/EN/tradingcen.png" border=0 title="Trading Central"></a>
<a href="#" *******="StockPop = ************('http://www.poems.com.hk/stockSummary/stockSummary.asp?iKey=275576635353574373b375a375c05','StockAnalytics','scrollbars=yes,resizable=yes,status=yes,left=0,top=0,width=1250,height=700,toolbar=0')"><img src="images/Corner/EN/Company.png" border=0 title="Stock Analytics "></a>"
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,215,336
Messages
6,124,328
Members
449,155
Latest member
ravioli44

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