Auto Login to intranet

Roy03111984

New Member
Joined
Jul 2, 2014
Messages
3
Hello Forum,

I'm trying run the following VBA code for Auto Login to a website. However, it is giving error at the end during final submit. Requesting your help ti sort this out. Both VBA code and HTML code i'm sharing below for your ease.

VBA CODE:

Sub IE_login()
Dim IE As Object, MyPass As String, MyLogin As String
Do
MyLogin = InputBox("Please enter your username", "Enter username", "Username")
MyPass = InputBox("Please enter your password", "Enter Password", "Password")

Loop Until Len(MyLogin) > 0 And Len(MyPass) > 0
Set IE = CreateObject("InternetExplorer.application")
IE.Visible = True
IE.navigate "https://www.wblt.ccms.teleperformance.com"
'Loop until ie page is fully loaded
Do Until IE.readyState = 4 '4=READYSTATE_COMPLETE
DoEvents
Loop
With IE.document.Forms("loginform")
.Item("credential_0").Value = MyLogin
.Item("credential_1").Value = MyPass
.submit


End With

Set IE = Nothing
End Sub

HTML CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" class="desktop">
<head>
****** http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
****** http-equiv="content-type" content="text/html; charset=utf-8">
****** name="viewport" content="width=device-width, initial-scale=1">
<title>[ CCMS ] || Welcome to the Contact Center Management System</title>
<link rel="stylesheet" href="/scheme/4.04708/css/classic.css" type="text/css" />
<link rel="shortcut icon" href="/images/ccms_favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="/images/ccms_favicon.ico" type="image/gif" />
******** type="text/javascript" src="/scheme/4.04708/js/common_ccms.js">*********>
</head>
****** class="login">
<div id="login"><!-- AuthCookieReason: no_cookie -->
<form method="POST" action="/auth/LOGIN" name="languageform" autocomplete="off">
<fieldset class="hidden_input">
<input type="hidden" name="destination" value="/ccms-bin/loading.pl?location=%2Findex.html">
<input type="hidden" name="_login_form_language_change" value="true">
</fieldset>
<fieldset>
<div class="language_ident">
<label>Please choose your language.</label>
<label class="mobile">Language</label>
<select id="language_ident" tabindex="3" name="language_ident" onchange="this.form.submit();">
<option value="115">Bahasa Indonesia (Republik Indonesia)</option>
<option value="103">Deutsch (Deutschland)</option>
<option value="101" selected="selected">English (United States)</option>
<option value="104">Español (España)</option>
<option value="102">Français (France)</option>
<option value="109">Italiano (Italia)</option>
<option value="107">Nederlands (Nederland)</option>
<option value="114">Portugués (Brasil)</option>
<option value="106">Portugués (Portugal)</option>
<option value="110">Ελληνικά (Ελλάδα)</option>
<option value="108">Русский (Россия)</option>
<option value="111">中文 (中国)</option>
<option value="112">日本語 (日本)</option>
<option value="116">ﺎﻠﻋﺮﺒﻳﺓ ﻢﺻﺭ</option>

</select>
</div>
</fieldset>
</form>

<form method="POST" action="/auth/LOGIN" name="loginform" autocomplete="off" accept-charset="utf-8">
<fieldset class="hidden_input">
<input type="hidden" name="destination" value="/ccms-bin/loading.pl?location=%2Findex.html">
</fieldset>

<fieldset>
<div class="login">
<label>Please enter your log in name and password below to continue.</label>
<label class="mobile">Log In Name</label>
<input class="loginname" type="text" tabindex="1" id="loginname" name="credential_0" size="30" alt="Account Name" autofocus/>
<label class="mobile">Password</label>
<input class="password" type="password" tabindex="2" id="password" name="credential_1" size="30" alt="Password" />
</div>
</fieldset>
<fieldset class="action_area">
<div class="form_submit">
<input class="submit" type="submit" tabindex="4" id="submit" value="Log In" />
</div>
</fieldset>
</form>
******** language="JavaScript">
<!--
document.loginform.credential_0.select();
document.loginform.credential_0.focus();
// -->
*********>
</div>

<!--[if lt IE 8]>
<div id="login_browser_message" class="message error">
<h2>Browser Incompatibility</h2>
<p>We have noticed the browser you are currently using is not supported by CCMS.</p>
<p>CCMS supports the latest versions of any of the following browsers:</p>
<ul>
<li><a href="http://www.google.com/chrome" >Chrome</a></a>
<li><a href="http://www.getfirefox.com" >Firefox</a></a>
<li><a href="http://windows.microsoft.com/en-US/internet-explorer/download-ie" >Internet Explorer</a></a>
</ul>
<p>Please upgrade your browser today.</p>
<p>Are you unable to upgrade from your current version of Internet Explorer? Try installing <a href="http://www.google.com/chromeframe" >Google Chrome Frame</a> so that CCMS can continue to provide a great user experience within your current browser.</p>
</div>
<![endif]-->

<div id="footer">
<p class="security">Teleperformance Restricted</p>
<ul class="links">
<li><a href="/supported_browsers-en_US.html" >Supported Browsers</a></li>
</ul>
<p class="copyright">
<span>4.04708</span> © 2016 Teleperformance
</p>
</div>
******** type="text/javascript">
if (typeof jQuery != "undefined") {
$(document).ready(function() {
try {
if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) == 6) {
document.execCommand("BackgroundImageCache", false, true);
}
} catch(e) {}
});
}
*********>
******** type="text/javascript">
if (typeof jQuery != "undefined") {
$(document).ready(function() {
$("form").submitOnce();
});
}
*********>

</body>
</html>
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,215,223
Messages
6,123,714
Members
449,118
Latest member
MichealRed

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