Major Nibbles
New Member
- Joined
- Aug 16, 2011
- Messages
- 1
Hello all,
Long time reader, first time writter.
I have been using VBA for a few months now and have read thread upon thread of how to use html control for IE. I have managed to fill out two forms and press a submit button, however when I navigate to the webpage I need it seems impossible. I have tried everytype of command I have found online, It seems the only way now is to see if any of you guys could tell me what I seem to be doing wrong!
I am currently using this on my code to fill out the first two forms, click a button, then wait and click another button, this all works:
This now takes you to an intranet site, the HTML code of the button I want to push looks like this:
I have tried the previous ways with its name, tabindex and value, however none work.
Hope you can help
Thanks,
Paul
PS i have HTML object library and internet controls referenced already.
Long time reader, first time writter.
I have been using VBA for a few months now and have read thread upon thread of how to use html control for IE. I have managed to fill out two forms and press a submit button, however when I navigate to the webpage I need it seems impossible. I have tried everytype of command I have found online, It seems the only way now is to see if any of you guys could tell me what I seem to be doing wrong!
I am currently using this on my code to fill out the first two forms, click a button, then wait and click another button, this all works:
Code:
MSG2 = MsgBox("The Macro will begin after clicking OK. Please press NOTHING unless prompted by a pop up. If something looks to be going wrong. Click on the excel spreadsheet in the toolbar and press ESC. Some areas may seem slow, this is to allow exceptions in the system to pass.Please also ensure no Internet Explorer windows are open...Would you like to proceed?", vbYesNo, "Important")
If MSG2 = vbNo Then
MsgBox "The macro will now end."
Exit Sub
End If
manager = Worksheets("home").Cells(7, 3)
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = 1
apiShowWindow IE.hwnd, SW_MAXIMIZE
'Go to this Web Page!
IE.Navigate "[URL]http://btpeople.intra.bt.com/psp/PTPRD/EMPLOYEE/EMPL/e/?url=http%3a%2f%2fbtpeople.intra.bt.com%3a61050%2fpsc%2fHR9PRD01%2fEMPLOYEE%2fHRMS%2fc%2fROLE_MANAGER.EP_NP_REDIRECT_MGR.GBL&FolderPath=PORTAL_ROOT_OBJECT.BT_HCM_MSS_HOME_PAGES.HC_MSS_PERFORMANCE_MGMT.HC_EPMSS_MGR_NOTES_GBL&IsFolder=false&IgnoreParamTempl=FolderPath%2cIsFolder[/URL]"
Do Until IE.readyState = 4 '//4 = readystate_complete
Loop
IE.Visible = True
introwcount = Worksheets("workings").Cells(1, 10)
Application.WindowState = xlMaximized
Application.Visible = True
user = InputBox(Prompt:="Please enter your username.", _
Title:="ENTER YOUR USERNAME", Default:="EIN")
pass = InputBox(Prompt:="Please enter your password.", _
Title:="ENTER YOUR PASSWORD", Default:="Password")
Application.WindowState = xlMinimized
IE.Visible = True
IE.document.getElementById("USER").Value = user
IE.document.getElementById("PASSWORD").Value = pass
Dim i As Integer
Dim max As Integer
max = 25
For i = 0 To max
If IE.document.getElementsByTagName("input").Item(i).getAttribute("type") = "submit" Then
IE.document.getElementsByTagName("input").Item(i).Click
Exit For
End If
Next i
Application.Wait (Now + TimeValue("0:00:3"))
IE.document.forms(0).Item("Yes").Click
Do Until IE.readyState = 4 '//4 = readystate_complete
Loop
This now takes you to an intranet site, the HTML code of the button I want to push looks like this:
HTML:
<tr>
<td height='53'></td>
<td colspan='3' nowrap='nowrap' valign='top' align='left'>
<input type='button' name='DERIVED_HR_NP_HR_NP_ADD_PB' id='DERIVED_HR_NP_HR_NP_ADD_PB' tabindex='37' value="Add a New Note" class='PSPUSHBUTTON' style="width:132px; " *******="submitAction_win0(this.form,this.name);" />
</td>
</tr>
I have tried the previous ways with its name, tabindex and value, however none work.
Hope you can help
Thanks,
Paul
PS i have HTML object library and internet controls referenced already.
Last edited: