Advertisement
Guest User

Untitled

a guest
Nov 24th, 2018
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub tset()
  2.  
  3.         Dim ieObject As Object: Set ieObject = CreateObject("InternetExplorer.Application")
  4.         CreateObject("WScript.Shell").AppActivate "Internet Explorer"
  5.        
  6.         With ieObject
  7.        
  8.         .Navigate "https://partners.subway.com/"
  9.         .Visible = True
  10.        
  11.         Do While (.Busy Or .READYSTATE <> 4)
  12.             Application.Wait (Now + TimeValue("0:00:10"))
  13.         Loop
  14.        
  15.         Dim ieUser: Set ieUser = .Document.GetElementByID("dnn_ctr370_Login_Login_DNN_txtUsername")
  16.         Dim iePass: Set iePass = .Document.GetElementByID("dnn_ctr370_Login_Login_DNN_txtPassword")
  17.         Dim ieButt: Set ieButt = .Document.GetElementByID("dnn_ctr370_Login_Login_DNN_cmdLogin")
  18.        
  19.         If IsObject(ieUser) And IsObject(iePass) And IsObject(ieButt) Then
  20.             ieUser.Value = "Colin34124"
  21.             iePass.Value = "Robert469"
  22.             ieButt.Click
  23.         End If
  24.        
  25.         Do While (.Busy Or .READYSTATE <> 4)
  26.             Application.Wait (Now + TimeValue("0:00:10"))
  27.         Loop
  28.        
  29.         .Navigate "https://liveiq.subway.com/Reporting/Content.aspx?action=daily&entityType=store&entityId=BBW4srKMGbM%3d"
  30.        
  31.         Do While (.Busy Or .READYSTATE <> 4)
  32.             Application.Wait (Now + TimeValue("0:00:10"))
  33.         Loop
  34.        
  35.         ' New Code can be added to your existing script
  36.        .Navigate "https://liveiq.subway.com/Reporting/Forms/ReportViewer.aspx?entityId=nRYWBAZnwNM~&entityType=store&extractReportId=HCK9b3rfRdM~&factor=590"
  37.  
  38.         Do While (.Busy Or .READYSTATE <> 4)
  39.             Application.Wait (Now + TimeValue("0:00:5"))
  40.         Loop
  41.        
  42.         Set oDoc = .Document
  43.        
  44.         With oDoc
  45.             Dim oReg As Object
  46.             Set oReg = CreateObject("VBScript.RegExp")
  47.            
  48.             With oReg
  49.                 .Pattern = "(\/Reporting\/Reserved\.ReportViewerWebControl\.axd\?ReportSession=(\w*\d*)&ControlID=(\w*\d*))"
  50.                 .Global = True
  51.                 .IgnoreCase = True
  52.                 .MultiLine = True
  53.             End With
  54.            
  55.             rcsid = False
  56.            
  57.             For Each elem In .getElementsByTagName("script")
  58.                 If oReg.Test(elem.innerText) Then
  59.                     Set matches = oReg.Execute(elem.innerText)
  60.                     rcsid = matches.Item(0)
  61.                     Exit For
  62.                 End If
  63.             Next
  64.         End With
  65.        
  66.         .Navigate "https://liveiq.subway.com/Reporting/Reserved.ReportViewerWebControl.axd?" & rcsid & "&Culture=1033&UICulture=1033&ReportStack=1&OpType=Export&FileName=Combo&ContentDisposition=OnlyHtmlInline&Format=EXCELOPENXML"
  67.  
  68.         ' ^^ New Code can be added to your existing script
  69.        
  70.         Application.Wait (Now + TimeValue("0:00:5"))
  71.        
  72.         .Quit
  73.        
  74.     End With
  75.    
  76.     Set ieObject = Nothing
  77.        
  78. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement