Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

write into a field on a web page

Status
Not open for further replies.

scottian

Programmer
Jul 3, 2003
955
GB
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

Ambition..........If you dont use it, you wont lose it
 
Define your Username and Passwords as a string and then use those as the values.
Code:
dim objIE as Object, objApp as Object
   [b]UserName = "David"
     Password = "WordPass"[/b]    
    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
  [b]objIE.Document.All(Username)= UserName
  objIE.Document.All(Password) = Password[/b] 
    if objIE is nothing then
        msgbox("IE window not found")
    else
        objIE.Document.links(5).click
    end if
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top