PDA

View Full Version : "Auto Complete" Internet Form



debauch
11-10-2005, 06:22 PM
Ok, can someone help point in the right direction with an example maybe ? What I am trying to do is, have information from an excel sheet (I will probably have a userform with a button to initiate this) and post the correct information in text boxes on a website. I have a site I visit, to create accounts for users. I.e - I input, first name (textbox) last name (next textbox) etc. I want to have all this automated.

I think the class 'internetexplorer' is what I want to use, but not sure how to use its functions. I need to be able to: tab (jump to next textbox), input text, and when all info is input, I would like it to hit the 'save' button.

I hope I was somewhat clear. I am sure I can clarify if someone asks questions a little more specific?

I did search b4 posting, but did not find quite what I was looking for ...

brettdj
11-10-2005, 06:25 PM
see my kb article on logging into a website http://vbaexpress.com/kb/getarticle.php?kb_id=399

The trick is to identify the Form and its item that you want to populate

debauch
11-10-2005, 06:41 PM
Thanks Brettdj,
It lays out groundwork, and I am uble to understand most of the code. By the looks of it, it will log my into my appication, but what is more important, is once logged in, have information copied from excel, and pasted into different textboxes. How do I identify what each textbox is called ?

What I am doing, is creating logins for users, but I enter 4 to 5 peices of info, for about 40 users a day. It is killer to tpye this junk ouut.

brettdj
11-10-2005, 07:34 PM
Trial and error :)
Sometimes the nameing gives a good indication

Can you share your web link with us?

stanl
11-11-2005, 08:33 AM
just an FYI - you might be able to do everything with the WinHttp.WinHttpRequest Object. You first determine if your form is a GET or [more likely] POST and then set your request against the action=
In terms of username/pw issues use setcredentials - something like



Dim oHTTP As New WinHttp.WinHttpRequest
oHTTP.Open "GET", http://mywebsite.com/login_page.asp, False
oHTTP.SetCredentials "user", "password", 0
oHTTP.Send



Stan

mvidas
11-11-2005, 12:54 PM
How do I identify what each textbox is called ?
First thing I do is go to View / Source. In there, I do a search for 'form', and look for the name of the form I'll be putting values into. From there I look for 'input', to find the input names to put the value to.

For example, look at the google advanced search page:
http://www.google.com/advanced_search
Though it isn't the greatest example, due to the non-formatted source of the page, it can still help show you. Go to view / source, and search for 'form'. The first one you see is in the line:
<form method=GET action="/search" name=f>

Now you know the form's name is 'f'. Now do a search for 'input'. The first one you see is in the line:
<input type=text value="" name=as_q size=25>

Though the name 'as_q' doesn't exactly explain what it does, if you look before that you'll see it goes with:
<font size=-1>with <b>all</b> of the words</font></td><td><input type=text value="" name=as_q size=25>
so that tells you the "with all the words" box has a textbox with name 'as_q'.

Do another search for 'input' and you'll see (at least in mine):
<input type=hidden name=hl value="en">

It is a type=hidden, and not type=text. It doesn't explain what that is; but it isn't the number-of-results dropdown (that has '<select name=num>' before it). The 'hl' is actually language, with 'en' being english, so it might not be that for you.

Looking for the next 'input type=text', you'll see:
<font size=-1>with the <b>exact phrase</b></font></td><td><input type=text size=25 value="" name=as_epq>

Just follow that general idea to find your form/input names.
Matt

malik641
11-11-2005, 01:09 PM
EDIT: Sorry, wanted to quote about brettdj's article. So....


see my kb article on logging into a website http://vbaexpress.com/kb/getarticle.php?kb_id=399

The trick is to identify the Form and its item that you want to populate

Yeah that all sounds good...but what if you wanted to login to any site? How can you make this dynamic??


I made a userform that asks for the web address, username and password. Now what I'm trying to do is have it load the page and look for the following text:
For Username:
"ID"
"Username"
"Email"

For Password:
"Password"....der

And I'm trying to use brettdj's way of finding this text...then using his "ieForm(#)" method to enter the values in...now this works if I KNOW which number to enter into the ieForm(), but some websites are different I've noticed...so how can I search and find the correct form #???? I've tried a couple different methods but it seems that I can't make this dynamic...


BTW, I'm giving this thread a 5 star rating :thumb Awesome new info for me :yes

mvidas
11-11-2005, 01:20 PM
Making it dynamic could be fun, though it would never be 100% accurate due to so many variances

I think it is funny how vbax uses 'name="vb_login_username"' in their input field. So a search on 'username' would find that, but would first find
"/* ***** styling for 'big' usernames on postbit etc. ***** */"
".bigusername { font-size: 13pt; }"
before it found
<td><input type="text" class="button" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="1" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';" /></td>

somtimes you might even see the above look like ... name=vb_login_username ... as the quotes aren't even necessary

Doing it dynamically sounds like it could be fun.. even creating something that lists all the forms/inputs would be a help

When I get a spare few minutes, I know what I'm gonna try! :)
Matt

malik641
11-11-2005, 02:25 PM
Making it dynamic could be fun, though it would never be 100% accurate due to so many variances

I think it is funny how vbax uses 'name="vb_login_username"' in their input field. So a search on 'username' would find that, but would first find
"/* ***** styling for 'big' usernames on postbit etc. ***** */"
".bigusername { font-size: 13pt; }"
before it found
<td><input type="text" class="button" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="1" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';" /></td>

somtimes you might even see the above look like ... name=vb_login_username ... as the quotes aren't even necessary

Doing it dynamically sounds like it could be fun.. even creating something that lists all the forms/inputs would be a help

When I get a spare few minutes, I know what I'm gonna try! :)
MattHold on...I'm a little confused...
Here is the code I run to log into Gmail...

Sub GMAIL(MyLogin As String, MyPass As String)
Dim ie As New InternetExplorer
Dim ULogin As Boolean
Dim ieForm As Variant
Dim WebPage As String

WebPage = "https://www.google.com/accounts/Login"
ie.Visible = True
ie.Navigate WebPage
'Loop until IE pages is fully loaded
Do Until ie.ReadyState = READYSTATE_COMPLETE
Loop
'Look for password Form by finding test "Password"
For Each ieForm In ie.Document.forms
If InStr(ieForm.innertext, "Password") <> 0 Then
ULogin = True
'enter details
ieForm(0).Value = MyLogin
ieForm(1).Value = MyPass
'login
ieForm.submit
'Exit For
Else
End If
Next
If ULogin = False Then MsgBox "User is aleady logged in"
Set ie = Nothing
End Sub

Lemme get this straight....what this code does is look through the source for the word "Password" in each Form in the code and performs the login if found?

So what do the numbers in ieForm mean?

Edit:I couldn't get stan's code to work, BTW...???:think:

brettdj
11-11-2005, 07:09 PM
I may have to edit the KB article to clear up what I am doing with the "Password" bit

If you break the code at For Each ieForm In ie.Document.forms and then look at ie.Document.Forms in the locals window, you will see that there are four forms (Form 1 is Forms(0), Form 2 is Forms(1) etc). The trick is to identify which form contains the login and password items, and then find the correct items

Now the first form gives a very good hint - it has "Password" in the form text - ie the descriptor next to the login. The first item in this form is the login, the third item is the password. Again item 1 is Item(0) etc

So I could have coded it directly as ie.Document.forms(0).Item(0).Value = MyLogin
ie.Document.forms(0).Item(2).Value = MyPass

I step through this code line by line to test that the right textbox is being used

Cheers

Dave

malik641
11-11-2005, 07:32 PM
I may have to edit the KB article to clear up what I am doing with the "Password" bit

If you break the code at For Each ieForm In ie.Document.forms and then look at ie.Document.Forms in the locals window, you will see that there are four forms (Form 1 is Forms(0), Form 2 is Forms(1) etc). The trick is to identify which form contains the login and password items, and then find the correct items

Now the first form gives a very good hint - it has "Password" in the form text - ie the descriptor next to the login. The first item in this form is the login, the third item is the password. Again item 1 is Item(0) etc

So I could have coded it directly as ie.Document.forms(0).Item(0).Value = MyLogin
ie.Document.forms(0).Item(2).Value = MyPass

I step through this code line by line to test that the right textbox is being used

Cheers

DaveI see....
:think:How to find the correct form...:think:

debauch
11-11-2005, 08:21 PM
Unfortunately, it is a secure website. I am unable to test this until I got back to work on Monday, but I have been testing the code on general websites to learn it. I will keep you posted, thanks for all the input everyone.

debauch
11-14-2005, 03:54 PM
Ok, so I have taken bits from everyone who has helped out here and was able to test it using http://www.google.com/advanced_search

and by editing below, I figured out how to use it, only MyLogin = sheets(example)range("a22") is the format I am using ... to take info from excel, to automate my forms.

ie.Document.forms(0).Item(0).Value = MyLogin
ie.Document.forms(0).Item(2).Value = MyPass

I have managed to test this on several sites by following Mvidas' tips. However, the source code for the site I need to use it with does not seem like the average source code, here it is (some is edited for privacy purposes) :


<html>
<head><base href="http://www.xxxxxxxxxxxxxxxxxxxx.com">
<title>CxxxxxxxUxxxxxxxx</title>


</head>

<frameset rows="80,*" frameborder=no border=0>

<!-- Banner frame -->

<frame name="banner" src="/docent/lms/banner.html" marginwidth=0 marginheight=0 scrolling=no>

<frameset cols="215,*" frameborder=no border=0>

<!-- Menu frame -->
<frame name="menubar" src="?CMD=GET&file=menubar.jsm&http_switch=false">


<!-- Main frame -->
<frameset rows="*,35" frameborder=no border=0>
<frame name="docent_main" src="?CMD=GET&file=catalog/plan_summary.jsm">
<frame name="bottomlogo" src="/docent/lms/bottomlogo.html" marginheight=5 scrolling=no>
</frameset>

</frameset>
</frameset>
</html>

As I naigate through pages, the source code doesn't seem to change. Is some of the cod e hidden somehow maybe ??

debauch
11-14-2005, 06:53 PM
I think I may be able to mange to figure it out if I learn how to 'tab' in the code. Is this possible ? I need to be able to automatically tab during and after the forms have been filled in, and to get to the forms

mvidas
11-15-2005, 06:10 AM
The source you have there is just of the main frame for the page, not the source for the whole page

Looking at the line:
<frame name="docent_main" src="?CMD=GET&file=catalog/plan_summary.jsm">

What happens if you try getting that?
If you're looking at www.domain.com/index.php (http://www.domain.com/index.php), try getting www.domain.com/index.php?CMD=GET&file=catalog/plan_summary.jsm (http://www.domain.com/index.php?CMD=GET&file=catalog/plan_summary.jsm) or maybe just www.domain.com/catalog/plan_summary.jsm (http://www.domain.com/catalog/plan_summary.jsm)

If you're using the IE object you could always change frames as well, I believe it is a property of the document property, like:IE.Document.Frames(0).Body.Forms(0)...Matt

malik641
11-15-2005, 07:40 AM
I'm very interested in Stan's approach...but I can't get it to work. Which Reference do I need to install? I'm about to check EVERY single one :mkay

Besides that I found this from MSDN, pretty informative...and it may be the easiest approach...but I'm not sure as this is all very new to me. So let me know if I'm wrong please.

Anyway here's what I'm TRYING to use from MSDN's website:
Option Explicit
'HttpRequest SetCredentials flags.
Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0
Const HTTPREQUEST_SETCREDENTIALS_FOR_PROXY = 1
Sub SetCredentials( _
ByVal bstrUserName As BSTR, _
ByVal bstrPassword As BSTR, _
ByVal Flags As HTTPREQUEST_SETCREDENTIALS_FLAGS _
)
Sub Internet()
Dim HttpReq As Object
' Create the WinHTTPRequest ActiveX Object.
Set HttpReq = New WinHttpRequest

' Switch the mouse pointer to an hourglass while busy.
MousePointer = vbHourglass

' Open an HTTP connection.
HttpReq.Open "GET", "http://microsoft.com (http://microsoft.com/)", False

' Set credentials for server.
HttpReq.SetCredentials "User Name", "Password", _
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
' Send the HTTP Request.
HttpReq.Send

' Get all response text.
Text1.Text = HttpReq.ResponseText
' Switch the mouse pointer back to default.
MousePointer = vbDefault

End Sub


But I have no luck so far....Can't figure out which Reference to check :dunno

Any ideas?

EDIT: BTW, I'm using Excel 2000. And I'm using Windows 2000 Professional.

mvidas
11-15-2005, 07:53 AM
Though I haven't played with http requests at all, after looking around it looks like you want to add a reference to 'Microsoft WinHTTP Services'
Matt

malik641
11-15-2005, 08:30 AM
Thanks Matt...Still unsure how to use the WinHttpRequest....I got this code to work that I found on the web:

Option Explicit
'HttpRequest SetCredentials flags.
Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0
Private Sub ListSubs()
Dim MyRequest As New WinHttpRequest
MyRequest.Open "GET", _
"https://www.google.com/accounts/ServiceLoginAuth"
'Set credentials
MyRequest.SetCredentials "yourname", "yourpassword", _
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
' Send Request.
MyRequest.Send

'And we get this response
MsgBox MyRequest.ResponseText

End Sub

But this just returns the XML data in a message box....not what I was going for....Opening the site and logging in.

I tried this because it seemed to be much cleaner/simple....oh well.
I'm going to leave this alone for a little, until I read-up on this stuff.

mvidas
11-15-2005, 08:41 AM
Joseph,

Looking mot at winhttp it looks an awful lot like xmlhttp, which I am familiar with. The .responsetext property does only return the source code for the page, not the text itself. Usually to get only the text of the web page requires an IE object, and getting the .InnerText of that. I know its a little strange using winhttp then using IE, but to give you an example:Option Explicit
'HttpRequest SetCredentials flags.
Const HTTPREQUEST_SETCREDENTIALS_FOR_SERVER = 0
Private Sub ListSubs()
Dim MyRequest As New WinHttp.WinHttpRequest
MyRequest.Open "GET", _
"https://www.google.com/accounts/ServiceLoginAuth"
'Set credentials
MyRequest.SetCredentials "yourname", "yourpassword", _
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
' Send Request.
MyRequest.Send

'And we get this response
Dim IE As Object
Set IE = CreateObject("internetexplorer.application")
IE.navigate2 "about:blank"
Do While IE.readystate <> 4
DoEvents
Loop

IE.Document.Body.InnerHTML = MyRequest.ResponseText
' IE.Visible = True
MsgBox IE.Document.Body.InnerText
End SubMatt

malik641
11-15-2005, 09:30 AM
First off, thanks Matt for taking my login and password out of my thread :thumb
I can't believe I forgot :doh:

Anyway The message box told me that I couldn't login....how come?

mvidas
11-15-2005, 09:50 AM
I got that same msgbox, I actually assumed you saw your name/pw in there too and changed your PW afterwards (since I tested with your data :))

Since I'm new to this, I can't say for sure, but perhaps it is because it is not a username we're entering here but an email address?

I also tried using my XMLHTTP technique of logging in, same response.
Dim MyRequest As Object 'New WinHttp.WinHttpRequest
Set MyRequest = CreateObject("MSXML2.XMLHTTP")
MyRequest.Open "GET", _
"https://www.google.com/accounts/ServiceLoginAuth"

'Set credentials

Dim strParams As String
MyRequest.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
strParams = "Email=email@gmail.com&Passwd=yourpassword"
' MyRequest.SetCredentials "email@gmail.com", "yourpassword", _
HTTPREQUEST_SETCREDENTIALS_FOR_SERVER
' Send Request.
MyRequest.Send strParamsNot sure what else to say, hopefully Stan will be around to help steer us in the right direction :)

malik641
11-15-2005, 09:55 AM
Well Gmail doesn't require the email address...you can put a username then password....:think:

mvidas
11-15-2005, 10:25 AM
I said that based solely on the wording of the https://www.google.com/accounts/ServiceLoginAuth page.. no idea why it isn't working

debauch
11-16-2005, 08:30 AM
The source you have there is just of the main frame for the page, not the source for the whole page

Looking at the line:
<frame name="docent_main" src="?CMD=GET&file=catalog/plan_summary.jsm">

What happens if you try getting that?
If you're looking at www.domain.com/index.php (http://www.domain.com/index.php), try getting www.domain.com/index.php?CMD=GET&file=catalog/plan_summary.jsm (http://www.domain.com/index.php?CMD=GET&file=catalog/plan_summary.jsm) or maybe just www.domain.com/catalog/plan_summary.jsm (http://www.domain.com/catalog/plan_summary.jsm)

If you're using the IE object you could always change frames as well, I believe it is a property of the document property, like:IE.Document.Frames(0).Body.Forms(0)...Matt

Ok perfect, you were right. I was able to get the correct frames source code, and I can muddle in there to figure it out, thank-you.

In order to have it work, I need to be able to "tab" through-out frames, to select links, and buttons to navigate back to the same spot each time. Once I can do this Im set .... i hope .... any sugguestions ?

debauch
11-21-2005, 06:26 AM
Dim ie As New InternetExplorer
This opens up a new browser, is there a way I could ask it to use the existing browser ? This way, I do not need as much code to navigate to my form pages. Thanks again.

mvidas
11-21-2005, 06:50 AM
You could have it reuse an existing window, if one exists: Dim IE As Object
On Error Resume Next
Set IE = GetObject(, "internetexplorer.application")
On Error GoTo 0
If IE Is Nothing Then
'no existing IE window
Set IE = CreateObject("internetexplorer.application")
IE.Navigate2 "about:blank"
Do While IE.readyState <> 4
DoEvents
Loop
Else
'IE now refers to an existing browser window
End IfMatt

debauch
11-21-2005, 10:17 AM
You have been great help, thanks matt.

debauch
11-25-2005, 12:27 PM
Ok, I am still ahving a little trouble. I am trying to use the existing browser window (this part is working) and copy from excel, to the textboxs on the existing window.

Below i have a sample of the source code for the site, and the vba that I am currently using as a test. can anyone help ?

SOURCE CODE :

User 1:
</TD>
<TD colspan="2" NOWRAP>
<INPUT TYPE="TEXT" NAME="User1" onchange="return setIsDirty('IsUserDirty1');" MAXLENGTH="15">
<FONT COLOR="RED">*</FONT>
<INPUT type="hidden" name="IsUserDirty1" value="0" >
</TD>
<TD colspan="2" NOWRAP>
<INPUT TYPE="TEXT" size="30" NAME="LastName1" onchange="return setIsDirty('IsUserDirty1');" MAXLENGTH="50">
<FONT COLOR="RED">*</FONT>
</TD>
<TD colspan="2" NOWRAP>
<INPUT TYPE="TEXT" NAME="PhoneNumber1" onchange="return setIsDirty('IsUserDirty1');" MAXLENGTH="24">
<FONT COLOR="RED">*</FONT>
</TD>
<TD colspan="2" NOWRAP>
<INPUT TYPE="TEXT" NAME="Email1" onchange="return setIsDirty('IsUserDirty1');" MAXLENGTH="50">
<FONT COLOR="RED">*</FONT>
</TD>
</TR>

VBA I am trying to use :


Option Explicit

Sub IE_login()

Dim IE As Object
On Error Resume Next
Set IE = GetObject(, "internetexplorer.application")
On Error GoTo 0
If IE Is Nothing Then

'no existing IE window
Set IE = CreateObject("internetexplorer.application")
IE.Navigate2 "about:blank"
Do While IE.ReadyState <> 4
DoEvents
Loop
Else
'IE now refers to an existing browser window
End If
'*---------------------------------------------------------------
'Dim IE As InternetExplorer
Dim C
Dim ULogin As Boolean, ieForm
Dim MyPass As String, MyLogin As String
redo:
'what I want it to do is ieform = yada yada
'mylogin should be sheet.range.a2 etc.
MyLogin = Sheets("Intro").Range("a28")
MyPass = Sheets("Intro").Range("b28")
If MyLogin = "" Or MyPass = "" Then GoTo redo
'Set IE = New InternetExplorer
IE.Visible = True
'IE.Navigate http://thewebsite I am using/ (http://thewebsite%20i%20am%20using/)

'Loop until ie page is fully loaded
Do Until IE.ReadyState = READYSTATE_COMPLETE
Loop

'Look for password Form by finding test "Password"

'HOW TO FIND FORM : search from , then find 'input' and following will be name, i.e "f"
'for site http://www.google.com/advanced_search

'On Error Resume Next
For Each ieForm In IE.Document.forms
If InStr(ieForm.innertext, "user1") <> 0 Then
ULogin = True
'enter details
ieForm(0).Value = MyLogin
ieForm(1).Value = MyPass
ieForm(2).Value = MyPass

'login
ieForm.submit
Exit For
Else
End If
Next
If ULogin = False Then MsgBox "Nope, sorry..."
Set IE = Nothing
End Sub

Sub SetRefs()
Dim ObRef
On Error Resume Next
' Adds Internet Controls Ref

ThisWorkbook.VBProject.References.AddFromGuid "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}", 1, 1
End Sub

I am well aware my code is sloppy, but I cannot wrap my head around this one.

Emily
11-26-2005, 06:37 AM
The code below works for me to login Gmail

Option Explicit
Dim myIE As InternetExplorer
Dim myIEdoc As HTMLDocument
Dim theForm As HTMLFormElement

Sub OpenWebpageAndLogin(URL As String, myPW As String, myID As String)
Dim theItm As HTMLFormElement
Dim i As Integer
Dim flg As Boolean
Set myIE = New InternetExplorer
With myIE
.Navigate URL
.Visible = True
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
End With
Set myIEdoc = myIE.Document
Set theForm = findFm(myIEdoc)
With theForm
For i = 0 To .Length - 1
Select Case .Item(i).Type
Case "password"
.Item(i).Value = myPW
flg = True
Case "text"
.Item(i).Value = myID
Case Else
End Select
Next
End With
If flg Then
theForm.submit
Else
myIE.Quit
MsgBox ("Unexpected Error, I'm quitting.")
End If
Set myIE = Nothing
End Sub

Function findFm(theDoc As HTMLDocument) As HTMLFormElement
Dim i As Integer, j As Integer
Dim theItm As HTMLFormElement
With theDoc.forms
For i = 0 To .Length - 1
Set theItm = .Item(i)
With theItm
For j = 0 To .Length - 1
If .Item(j).Type = "password" Then
Set findFm = theItm
Exit Function
End If
Next
End With
Next
End With
End Function

Sub test()
OpenWebpageAndLogin "https://www.google.com/accounts/ServiceLoginAuth", "YourPassword", "YourUserName"
End Sub

Emily
11-26-2005, 06:47 AM
Some web site may have two more questions (total 4 questions) for login.


Option Explicit
Dim myIE As InternetExplorer
Dim myIEdoc As HTMLDocument
Dim theForm As HTMLFormElement
Sub OpenWebpageAndLogin(URL As String, myPW As String, myID As String, _
Optional myAns As String, Optional selItem As Integer)
Dim theItm As HTMLFormElement
Dim i As Integer
Dim Testing As Variant
Dim flg As Boolean
Set myIE = New InternetExplorer
With myIE
.Navigate URL
.Visible = True
Do While .Busy: DoEvents: Loop
Do While .ReadyState <> 4: DoEvents: Loop
End With
Set myIEdoc = myIE.Document
Set theForm = findFm(myIEdoc, "password")
With theForm
For i = 0 To .Length - 1
Testing = .Item(i).Name
Select Case .Item(i).Name
Case "password"
.Item(i).Value = myPW
flg = True
Case "username"
.Item(i).Value = myID
Case "answer"
.Item(i).Value = myAns
Case "questionid"
.Item(i).Value = selItem 'the quation's number
Case Else
End Select
Next
End With
If flg Then
Set theForm = findFm(myIEdoc, "submit")
Else
myIE.Quit
MsgBox ("Unexpected Error, I'm quitting.")
End If
Set myIE = Nothing
End Sub

Function findFm(theDoc As HTMLDocument, theType As String) As HTMLFormElement
Dim i As Integer, j As Integer
Dim theItm As HTMLFormElement
With theDoc.forms
For i = 0 To .Length - 1
Set theItm = .Item(i)
With theItm
For j = 0 To .Length - 1
If .Item(j).Type = theType Then
Set findFm = theItm
If theType = "submit" Then .Item(j).Click
Exit Function
End If
Next
End With
Next
End With
End Function


Sub test()
OpenWebpageAndLogin URL:= (http://=/)"http://www.officefans.net/cdb/logging.php?action=login (http://www.officefans.net/cdb/logging.php?action=login)", _
myPW:="xxxxxxxx", myID:="Emily", myAns:="xxxx", selItem:=7
End Sub

debauch
11-26-2005, 08:02 AM
Ahh! I think this confuses me even more. I will attmept with the code and see what happens. Any hints on the source code I provided; what part I to focus on ?

debauch
02-20-2006, 01:17 PM
Ok, I managed to get logged in using everyone's help.

I am now looking for something I think I am very close to getting, but oh so very stuck. I have been trying to get this for months.

I need do a similar task, only using the existing browser window, not a new one.
I need to create a online account for users (first name, last name, email etc.)

I am attaching the source code, and my vba, and hoping someone can correct what I am doing wrong, I have tried many things to not avail.

(P.S - if if helps, there is a side bar menu, and the source code I have posted, is the main page, maybe that is my problem? I am not selecting the main page somehow?)

Pease Help! this is driving me nuts!!