Excel 自动登录将不会输入凭据提示错误

Excel 自动登录将不会输入凭据提示错误,excel,vba,internet-explorer,Excel,Vba,Internet Explorer,我在尝试自动化Kronos的登录过程时遇到了一个错误。我能够访问该站点,但它在输入我的凭据之前就停止了 我已经查阅了我的旧代码以供参考,并试图在堆栈上找到解决方案,但一直无法找到。我引用了MS HTML对象库、MS Internet控件和WebServices 1.0类型库 Sub LoginToKronos() Const cURL = "https://wikainstruments-sso.prd.mykronos.com/" Const cUserID = "firstna

我在尝试自动化Kronos的登录过程时遇到了一个错误。我能够访问该站点,但它在输入我的凭据之前就停止了

我已经查阅了我的旧代码以供参考,并试图在堆栈上找到解决方案,但一直无法找到。我引用了MS HTML对象库、MS Internet控件和WebServices 1.0类型库

  Sub LoginToKronos()

  Const cURL = "https://wikainstruments-sso.prd.mykronos.com/"
  Const cUserID = "firstname.lastname@business.com"
  Const cPassword = "Password123"

  Dim IE As InternetExplorer
  Dim doc As HTMLDocument
  Dim LoginForm As HTMLFormElement
  Dim UsernameInputBox As HTMLInputElement
  Dim SubmitButton As HTMLInputButtonElement
  Dim PasswordInputBox As HTMLInputElement
  Dim LogOnButton As HTMLInputButtonElement

  Set IE = New InternetExplorer

  IE.Visible = True
  IE.navigate cURL

  'Wait for initial page to load

  Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop

  Set doc = IE.document

  'Get the only form on the page

  Set LoginForm = doc.forms(0)

  'Get the Username textbox and populate it
  'input name="loginfmt" id="i0116" value="" class="form-control ltr_override" type="email"

  Set UsernameInputBox = doc.getElementById("i0116")
  UsernameInputBox.Value = cUserID

  'Get the form input button and click it

  Set SubmitButton = doc.getElementById("idSIButton9")
  SubmitButton.Click

  'Get the Password textbox and populate it
  'input name="Password" id="passwordInput" class="text fullWidth" type="password"


  Set PasswordInputBox = doc.getElementById("passwordInput")
  PasswordInputBox.Value = cPassword

  'Get the form input button and click it

  Set LogOnButton = doc.getElementById("idSIButton9")
  LogOnButton.Click

  'Wait for the new page to load

  Do While IE.readyState <> READYSTATE_COMPLETE Or IE.Busy: DoEvents: Loop

  'avoid any pop up

  End Sub
Sub-LoginToKronos()
常数旋度=”https://wikainstruments-sso.prd.mykronos.com/"
Const cUserID=“firstname。lastname@business.com"
Const cPassword=“Password123”
Dim IE作为InternetExplorer
作为HTMLDocument的Dim doc
作为HTMLFormElement的Dim LoginForm
作为HTMLInputElement的Dim UsernameInputBox
将SubmitButton变暗为HTMLInputButtonElement
作为HTMLInputElement的Dim PasswordInputBox
作为HTMLInputButtonneElement的Dim LogOnButton按钮
Set IE=新的InternetExplorer
可见=真实
例如,卷曲
'等待加载初始页面
在IE.readyState readyState_完成或IE.Busy:DoEvents:Loop时执行
Set doc=IE.document
'获取页面上唯一的表单
Set LoginForm=doc.forms(0)
'获取用户名文本框并填充它
'输入name=“loginfmt”id=“i0116”value=”“class=“表单控制ltr\U覆盖”type=“电子邮件”
设置UsernameInputBox=doc.getElementById(“i0116”)
UsernameInputBox.Value=cUserID
'获取表单输入按钮并单击它
设置SubmitButton=doc.getElementById(“idSIButton9”)
提交按钮。单击
'获取密码文本框并填充它
'input name=“Password”id=“passwordInput”class=“text fullWidth”type=“Password”
设置PasswordInputBox=doc.getElementById(“passwordInput”)
PasswordInputBox.Value=cPassword
'获取表单输入按钮并单击它
设置LogOnButton=doc.getElementById(“idSIButton9”)
登录按钮。单击
'等待加载新页面
在IE.readyState readyState_完成或IE.Busy:DoEvents:Loop时执行
“避免出现任何弹出窗口
端接头

很高兴填充凭据。

我可以确认是否要登录到Workforce Dimensions吗?是的。该流程最近发生了更改,因此现在要长得多/耗时得多,并且每次需要打卡时都需要输入凭据。目标是自动化凭证输入过程,并将其应用于我桌面上的按钮。点击一下,砰的一声,理论上我就进去了。这个url够了吗?我不确定我能不能更改这个url。我之所以这么说是因为我在其实现的过渡阶段使用了一个备用URL(类似,但不同),我的时间戳被记录下来,但人力资源部看不到。有没有其他方法可以在不改变URL的情况下通过“RT Error 91”工作?谢谢你的帮助