Public Sub LoginMediaCentre(ByVal szUserName As String, ByVal szPassword As String)
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
' Navigate to Media Server .
IE.Navigate "http://mediaserver:49490/login.aspx?ReturnUrl=%2fdefault.aspx"
' Wait for the page to load.
Do While IE.Busy Or IE.ReadyState <> 4
DoEvents
Loop
' Enter username
IE.Document.getElementById("Login1_UserName").Value = szUserName
' Enter password
IE.Document.getElementById("Login1_Password").Value = szPassword
' Submit the sign in.
IE.Document.getElementById("Login1_LoginButton").Submit
' Destroy object.
Set IE = Nothing
End Sub
Private Sub Form_Load()
LoginMediaCentre "mcuser", "password"
Unload Me
End Sub
|