VBA for Click on Image login button

gmmdinesh

New Member
Joined
Sep 16, 2017
Messages
8
Hi Everyone
I have a code to Automatic log in a website..the website having Image login button.
The problem is this code does not click that login button.
Anyone knows how to click on this type of image button.

VBA Code
Code:
[/COLOR]Sub Auto_login()    Set IE = CreateObject("InternetExplorer.Application")
       my_url = "https://sapitsp.tsjl.com/sap/bc/gui/sap/its/catw?sap-language=EN"
    With IE
        .Visible = True
        .Navigate my_url
            Do Until Not IE.Busy And IE.ReadyState = 4
        DoEvents
    Loop
    End With
IE.Document.getElementById("sap-user").Value = Sheets("Portal").Range("B21").Value
    IE.Document.getElementById("sap-password").Value = Sheets("Portal").Range("B22").Value
For Each MyHTML_Element In Document.getElementsByTagName("callsubmitlogin")
If MyHTML_Element.Type = "image" Then
MyHTML_Element.Click: Exit For
End If
Next
    Do Until Not IE.Busy And IE.ReadyState = 4
        DoEvents
    Loop

    End Sub[COLOR=#333333]


HTML code
Code:
[/COLOR]<form name="loginForm" action="/sap/bc/gui/sap/its/catw" method="post">     <table border="0">       <tbody><tr height="30"><td> </td></tr>       <tr><td width="100"></td>             <td class="blueBold" align="right">SAP User ID:   </td>             <td><input type="text" id="sap-user" name="sap-user" tabindex="1" size="12" maxlength="12"></td>             <td width="20"> </td>         </tr>           <tr><td>             <input name="~logininput" type="hidden" value="1">           </td></tr>         <tr><td width="100"></td>           <td class="blueBold" align="right">Password:   </td>           <td><input type="password" id="sap-password" name="sap-password" tabindex="2" size="8" maxlength="8"></td>           <td></td><td width="130"> </td>         </tr>         <tr><td>             <input name="~passwdinput" type="hidden" value="1">             </td></tr>         <tr><td> </td>             <td class="BlueBold" align="right" colspan="5" wrap=""></td>         </tr>       </tbody></table>   <table border="0">     <tbody><tr><td>         <input type="image" src="/sap/public/bc/its/mimes/ess_global/99/EN/images/buttons/login.gif" value="Logon" *******="callSubmitLogin(' me->co_event_login '); return false;">       </td>       <td>         <a href="sapbcguisapits/zse_respwd/!?sap-language=EN" target="_blank">         <img src="/sap/public/bc/its/mimes/ess_global/99/EN/images/buttons/forgotpw.gif" border="0" tabindex="3">         </a>       </td>      </tr>    </tbody></table>   <table border="0" width="95%">     <tbody><tr><td height="10"> </td></tr>     <tr><td class="infoBlack">For information about Time Management and time codes, refer to: <font color="#49166D"><b></b>          <a href="http://habitat.tsl.telus.com/telusEmployeePortal/content/en/iep/human_resources/site/human_resources/hr_categories/time_off_and_vacation/time_administration/anchor_content_000376.xhtml" target="_blank">myHR >Attendance & Time Off > Time Management Help and Information          </a></font>.</td></tr>       <tr><td class="infoBlack">For technical difficulties, SAP user id or password problems, please contact the SPOC help desk at<font color="#49166D"><strong>1-877-600-7762</strong></font>. </td></tr>     <tr><td height="5"> </td></tr>     <tr>       <td class="infoBlack">Some areas within TELUS have been directed to enter their time via the SAP web entry tool, however additional areas within TELUS will be added in future phases. If you receive the error message "You have no authorization for Transaction CATW", please confirm with your manager if you are to be using this tool.  If yes, please ask your manager to fill out the          <a href="https://cadmus.tsl.telus.com/cgi-bin/accreq/req/sap.cgi" target="_blank">SAP ERP Access Application Form</a>       </td>     </tr>   </tbody></table></form>[COLOR=#333333]

Thanks in advance

 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Hi Everyone
I have a code to Automatic log in a website..the website having Image login button.
The problem is this code does not click that login button.
Anyone knows how to click on this type of image button.

VBA Code
Code:
Sub Auto_login()    Set IE = CreateObject("InternetExplorer.Application")
       my_url = "https://sapitsp.tsjl.com/sap/bc/gui/sap/its/catw?sap-language=EN"
    With IE
        .Visible = True
        .Navigate my_url
            Do Until Not IE.Busy And IE.ReadyState = 4
        DoEvents
    Loop
    End With
IE.Document.getElementById("sap-user").Value = Sheets("Portal").Range("B21").Value
    IE.Document.getElementById("sap-password").Value = Sheets("Portal").Range("B22").Value
For Each MyHTML_Element In Document.getElementsByTagName("callsubmitlogin")
If MyHTML_Element.Type = "image" Then
MyHTML_Element.Click: Exit For
End If
Next
    Do Until Not IE.Busy And IE.ReadyState = 4
        DoEvents
    Loop

    End Sub



HTML code
Code:
<form name="loginForm" action="https://www.mrexcel.com/sap/bc/gui/sap/its/catw" method="post">                                                                                                                                                                                [TABLE="width: 95%"]
<tbody>[TR]
[TD="class: infoBlack"]   [/TD]
[/TR]
</tbody>[/TABLE]
</form>


Thanks in advance



HTML Code wrongly placed on previous Post Please see the Next Post
 
Upvote 0
Hi Everyone
I have a code to Automatic log in a website..the website having Image login button.
The problem is this code does not click that login button.
Anyone knows how to click on this type of image button.


VBA Code
Code:
Sub Auto_login()
    Set IE = CreateObject("InternetExplorer.Application")
       my_url = "https://sapitsp.tsjl.com/sap/bc/gui/sap/its/catw?sap-language=EN"
    With IE
        .Visible = True
        .Navigate my_url
            Do Until Not IE.Busy And IE.ReadyState = 4
        DoEvents
    Loop
    End With
IE.Document.getElementById("sap-user").Value = Sheets("Portal").Range("B21").Value
    IE.Document.getElementById("sap-password").Value = Sheets("Portal").Range("B22").Value
For Each MyHTML_Element In Document.getElementsByTagName("callsubmitlogin")
If MyHTML_Element.Type = "image" Then
MyHTML_Element.Click: Exit For
End If
Next
    Do Until Not IE.Busy And IE.ReadyState = 4
        DoEvents
    Loop


    End Sub




HTML code
Code:
<input *******="callSubmitLogin(' me->co_event_login '); return false;" src="/sap/public/bc/its/mimes/ess_global/99/EN/images/buttons/login.gif" type="image" value="Logon">


Thanks in advance
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,060
Latest member
mtsheetz

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