I am trying to build a simple macro, which enable user to select required rows from an excel sheet and export it to a web service. The macro should be able to authenticate the user with username and password to make sure that he has permission to upload the data. When the user selects the required row, IE opens authentication page of web service. I am currently trying to capture the url change when the user log in successfully to the web service to verify the credentials.
Is there a better way to authenticate the user? I settled in for authenticating using websites main log in page , as I don't want to send the username and password through the script.
Here is how my code look like:
Call NavigateToURL(--url of login page--)
Public Sub NavigateToURL(ByVal argURL As String)
Dim objIE As Object
Set objIE = CreateObject("InternetExplorer.Application")
With objIE
.Visible = True
.Silent = True
.Navigate argURL
Do Until objIE.LocationURL() = (--url after successfull log in--)
DoEvents
Loop
If n = (---url after successful log in--) Then
objIE.Navigate (--redirect to another url)
Else
MsgBox ("Sorry. Authentication Failed.")
End If
But the part after the Do-Until Loop is not working properly. Can any body point out where I have gone wrong?