Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. Sub Van()
  2.  
  3. Dim IE As Object
  4. Dim IE2 As Object
  5.  
  6. Set IE = CreateObject("InternetExplorer.Application")
  7. 'Set IE2 = CreateObject("InternetExplorer.Application")
  8.  
  9. IE.navigate ("https://secure.apia.com.au/NASApp/apia/CRQuoteServlet")
  10.  
  11. IE.Visible = True
  12.  
  13. Do
  14. DoEvents
  15. Loop Until IE.readystate = 4
  16.  
  17. Set d = IE.document
  18.  
  19. d.GetElementbyid("over50_Y").Click
  20. d.GetElementbyid("retired_Y").Click
  21. d.GetElementbyid("coverType_COM").Click
  22. d.GetElementbyid("principalDriver").Value = 55
  23. d.GetElementbyid("select_caravan_model").Click
  24.  
  25.  
  26. Application.Wait (Now + TimeValue("00:00:03"))
  27.  
  28.  
  29.  
  30. Set IE2 = GetIE("https://secure.apia.com.au/NASApp/apia/CRQuoteServlet? pageAction=openModelSelectionWindow&currentSequenceNumber=")
  31.  
  32. IE2.document.getElementsByTagName("select")(0).Value = "JAY"
  33.  
  34.  
  35. 'Also tried the line below
  36. 'IE2.document.GetElementsbyname("caravanMake")(0).SelectedIndex = 83
  37.  
  38.  
  39. End Sub
  40.  
  41. Function GetIE(sAddress As String) As Object
  42.  
  43. Dim objShell As Object, objShellWindows As Object, o As Object
  44. Dim retVal As Object, sURL As String
  45.  
  46.  
  47. Set retVal = Nothing
  48. Set objShell = CreateObject("Shell.Application")
  49. Set objShellWindows = objShell.Windows
  50.  
  51. 'see if IE is already open
  52. For Each o In objShellWindows
  53. sURL = ""
  54. On Error Resume Next
  55. sURL = o.LocationURL
  56. On Error GoTo 0
  57. If sURL <> "" Then
  58. 'MsgBox sURL
  59. If sURL = sAddress Then
  60. Set retVal = o
  61. Exit For
  62. End If
  63. End If
  64. Next o
  65.  
  66. Set GetIE = retVal
  67. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement