Consulting

Results 1 to 2 of 2

Thread: html problem with vba

  1. #1
    VBAX Newbie
    Joined
    Feb 2014
    Posts
    1
    Location

    html problem with vba

    Hi, I'm Gianna and first of all SORRY FOR MY ENGLISH!


    I need your help to solve a big (to me!) problem.


    Monthly I need to download a huge quantity of electrical data from Enel Distribuzione page.


    (there is a security problem the first time but it is safe!!!)


    and I'm trying to automatically download them with a VBA macro but it doesn't work.


    Please can you help me?


    Gianna

    Sub Enel()
    Dim HTMLDoc As HTMLDocument
    Dim oBrowser As InternetExplorer
    Dim oHTML_Element As IHTMLElement
    Dim sURL As String








    On Error GoTo Err_Clear
    sURL = "https://wdmdd.enel.it/azienda/index_azienda.asp"
    Set oBrowser = New InternetExplorer
    oBrowser.Silent = True
    oBrowser.timeout = 60
    oBrowser.navigate sURL
    oBrowser.Visible = True


    Do
    ' Wait till the Browser is loaded
    Loop Until oBrowser.readyState = READYSTATE_COMPLETE


    Set HTMLDoc = oBrowser.document




    HTMLDoc.document.all.UserName.Value = "IT001E0038"
    HTMLDoc.document.all.Password.Value = "Eseio12"




    For Each oHTML_Element In HTMLDoc.getElementsByTagName("input")
    If oHTML_Element.Name = "Password" Then oHTML_Element.Click: Exit For
    Next


    ' oBrowser.Refresh ' Refresh If Needed
    Err_Clear:
    If Err <> 0 Then
    Err.Clear
    Resume Next
    End If


    End Sub

  2. #2
    It looks like the username section is in a iframe... You'll probably have to grab the document to that URL instead.

    https://wdmdd.enel.it/azienda/curve_azienda.asp

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •