• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • Last Modified:

for Richie and zzzzzooc new adventure with ie object...

How to insert user and password in frame page and click connetti?
assuming have in A1 of sheet the value of user and in B1 the value of password..
Tks To all.

NOTE: if is possible in VBA for excel
attached file with index page and frame
http://www.mytempdir.com/685359
0
sal21
Asked:
sal21
  • 8
  • 3
1 Solution
 
zzzzzoocCommented:
The below is based on the file you uploaded. It'll locate the frame and input elements, fill them in, and execute the "connect()" javascript function. It may require tweaking to work with VBA.

Form1:
------------------
'include reference: Microsoft HTML Object Library
Option Explicit
Private Sub Form_Load()
    WebBrowser1.Navigate "file://c:\test_file\services.htm"
End Sub
Private Sub Command1_Click()
    Dim doc As HTMLDocument
    Set doc = WebBrowser1.Document
    If (Not (doc Is Nothing)) Then
        Dim wnd As HTMLWindow2
        Set wnd = doc.frames("FrameDati")
        If (Not (wnd Is Nothing)) Then
            Set doc = wnd.Document
            Dim frm As HTMLFormElement
            Set frm = doc.Forms("FormDati")
            If (Not (frm Is Nothing)) Then
                frm.Item("USER-ID_0").Value = "user"
                frm.Item("PASSWORD_0").Value = "pass"
                'the Connect button calls the script "connect()" so
                'we can just call that directly
                Call doc.parentWindow.execScript("connect();")
            End If
        End If
    End If
End Sub
0
 
sal21Author Commented:
Hi "mithics" mzzzzzooc but i have post:

assuming have in A1 of sheet the value of user and in B1 the value of password...

and have a dubt... the code work with vba for ecxel?

0
 
zzzzzoocCommented:
You'll have to cover the excel portion yourself. Just retrieve the user & pass values from the cells and replace them properly:

frm.Item("USER-ID_0").Value = the_username
frm.Item("PASSWORD_0").Value = the_password
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
sal21Author Commented:
ok....for excel refference in cell but you macro not work in vba for excel
0
 
zzzzzoocCommented:
It wasn't a macro.. I was just explaining where you would need to change my example.
0
 
sal21Author Commented:
NOTE: if is possible in VBA for excel
0
 
sal21Author Commented:
Tks for suggestion...
I post a macro toomoroow, and that work perfect only if i call directly the page frame...
In this case yoy help me and i suggest you about my macro already have..
Wath you think about?
0
 
sal21Author Commented:
ahhahahh... zzzzzooc
 tks for suggestion in vb but i cannot use vb only vba fopr excel
Tks... expresso coffe and pizza from Napoli for you:-)
0
 
sal21Author Commented:
zzzzzooc.... here the macro work if i call directly the page
now have difficult to intercept wath is the frame in all page....  

Sub PROVA()

' Prepare to open the web page
    Set IE = CreateObject("InternetExplorer.Application")

    With IE
        .Visible = True
        .Navigate "http://crediti/cr/html/logon/logonAutenticazione.html"

        '.Navigate "http://crediti/"

        ' Loop until the page is fully loaded
        Do Until Not .Busy
            DoEvents
        Loop

        ' Make the desired selections on the web page and click the submit Button
        ' IE ie.document.all.Item LEGGE NELLA PAGINA html il tag di riferimento
        Set ipf = IE.Document.all.ITEM("USER-ID_0")
        ipf.Value = Range("A1")    '.Value
        Set ipf = IE.Document.all.ITEM("PASSWORD_0")
        ipf.Value = Range("B1")    '.Value

        IE.Document.forms(0).submit

        Do Until Not .Busy
            DoEvents
        Loop

    End With
    IE.Quit
    Set IE = Nothing

End Sub
0
 
sal21Author Commented:
WOW.... used and arranged your code. now work perfect!!!!!!!!!!
Tks zzzzzooc
0
 
sal21Author Commented:
A+A+A!!!!!
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 8
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now