write into a field on a web page
write into a field on a web page
(OP)
Please someone help. I want a macro to write into a field on a web page. The page is a login page with two fields; Username and Password. But it wont put the username or password into the page fields.
Sub Main
dim objIE as Object, objApp as Object
Set objApp = CreateObject("Shell.Application")
for i = 0 to 25
strName = ""
On Error Resume Next
strName = objApp.Windows(i).document.url
if InStr(strName,"MySite.co.uk") then
set objIE = objApp.Windows(i)
exit for
end If
next
objIE.Document.All(Username)= "MyPassword"
if objIE is nothing then
msgbox("IE window not found")
else
objIE.Document.links(5).click
end if
End Sub
Sub Main
dim objIE as Object, objApp as Object
Set objApp = CreateObject("Shell.Application")
for i = 0 to 25
strName = ""
On Error Resume Next
strName = objApp.Windows(i).document.url
if InStr(strName,"MySite.co.uk") then
set objIE = objApp.Windows(i)
exit for
end If
next
objIE.Document.All(Username)= "MyPassword"
if objIE is nothing then
msgbox("IE window not found")
else
objIE.Document.links(5).click
end if
End Sub
Ambition..........If you dont use it, you wont lose it
RE: write into a field on a web page
CODE
UserName = "David"
Password = "WordPass"
Set objApp = CreateObject("Shell.Application")
for i = 0 to 25
strName = ""
On Error Resume Next
strName = objApp.Windows(i).document.url
if InStr(strName,"MySite.co.uk") then
set objIE = objApp.Windows(i)
exit for
end If
next
objIE.Document.All(Username)= UserName
objIE.Document.All(Password) = Password
if objIE is nothing then
msgbox("IE window not found")
else
objIE.Document.links(5).click
end if