[CONSULTA WEB] No la puedo hacer :-(

Qete_ARG

Board Regular
Joined
Oct 20, 2005
Messages
72
Hola gente...puse este mensaje tambien en el foro en ingles, pero hay muchas consultas y no tuve la suerte de obtener una respuesta... :(
Estoy tratando de automatizar el seguimiento del cierre de unos fondos de inversión, pero no puedo hacer una consulta web desde Excel porque me da un error:
"No se puede abrir 'http://pagina.com' . No se puede descargar la información solicitada"

La pagina de donde bajo la info es:


Mirando el codigo fuente de la pagina en cuestion, me doy con que la tabla que necesito está ubicada en:


Lo que veo es que una pagina HTTPS, pero si abren la pagina se van a dar cuenta que no pide user ni pass....
Me tiene loco esto y hasta aca llegó mi conomiento...alguien podría darme una manito? :)
Muchiiiisimas gracias desde ya!!

Saludos desde Argentina,
Miguel.
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Miguel,

Edité su mensaje, quitando su "firma" porque su firma contiene su dirección de correo-e. Pero usted necesita editar su perfil para quitar su dirección actual de correo-e. Los "bots" la agarrá y a usted le llegará una cantidad de SPAM sin fin. Ponga algo como fulano.de.talytalarrobahotmail.com

Acerca de su pregunta actual, ¿qué es lo que usted está haciendo dentro de Excel? Por lo general no acceso páginas de la internet directamente de Excel sino por medio de IE (Internet Explorer).
 
Upvote 0
Hola Greg, gracias por el consejo, ya corregi mi firma!!

Respecto a mi consulta, diariamente copio manualmente los datos de la tabla que detalle en el primer post (
Code:
https://hb.bbv.com.ar/hbbf/FondosSC.jsp
) para llevar una historia del cierre de los fondos de inversión (Investment Funds).
Lo que quiero hacer es automatizar ese trabajo y descargar diariamente esa tabla a un archivo excel. Intenté con la consulta web de Excel y me da un error al intentar descargarla.
:(
 
Upvote 0
Bueno, para mí, automatizar el proceso de agarrar datos de la Internet nunca es cosa muy fácil porque la estructura de los objectos de una página de HTML no comprendo bien ni he topado con una documentación muy buena. Cada vez que hago un proyecto donde tengo que automatizar IE, siento que estoy embarcando a un viaje sin tener mapa ni brújula.

Sin embargo, lea lo que puede de ambos ejemplos de Nate que se ve aquí en nuestro HALL OF FAME. Con estos ejemplos y mucho "trial and error" usted debe de poder llegar a una solución.

Cordialmente,
 
Upvote 0
Hola nuevamente y muchas gracias por contestar Greg!
Acabo de terminar de Automatizar la bajada de datos de la web que mencione antes, y aunque no quedó taaaan estetica, al menos cumple con su cometido. (even when it isn´t so goodlooking :) it achieves it's goal)
Leyendo algunos posts en el foro encontre uno de Joe Was que me vino como anillo al dedo, y he aquí el código:

Code:
Sub Actualizar_Fondos() 'from Joe Was, de MrExcel
Dim wb As Workbook, ws As Worksheet
Dim IE As Object

Const strURL As String = "https://hb.bbv.com.ar/hbbf/FondosSC.jsp"

Set wb = ActiveWorkbook
Set ws = wb.Sheets(1)

Set IE = CreateObject("InternetExplorer.Application")

'IE.Visible = True
IE.Navigate strURL

Do While IE.ReadyState <> 4
DoEvents
Loop

IE.ExecWB 17, 2
IE.ExecWB 12, 2

ActiveSheet.Paste Range("A1")
'IE.Visible = False

'Aca termina el codigo de Joe Was
'*****************************************
'Termino de actualizar el cierre de los fondos,
'ahora tengo que guardar uno por uno para tener
'el historico
Application.ScreenUpdating = False
Range("D12:D21").Select
    Selection.Copy
    Range("a65536").Select
    Selection.End(xlUp).Offset(1, 2).Select
    'Selection.End(xlUp).Activate
    'ActiveCell.Offset(1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=True
    Range("a65536").Select
    Selection.End(xlUp).Offset(1, 0).Select
    Application.ScreenUpdating = True
    ActiveCell.Value = Now()
     

End Sub

Por ahora y mientras no me cambien la estructura de la pagina web esta todo listo!!
Lo expongo aca por si a alguien le sirve.
Cualquier opinion es bienvenida!!
Saludos,
Miguel.
 
Upvote 0
Historico Fondos de Inversion BBVA.xls
ABCDEFGHIJKL
10FondoMonedaPrecioVariacinDiariaVariacin30dasMsInformacin
11
12FBAAHOMP$1,795,0640.5-1.65
13FBAAccGlAU$S29,671-0.541.73
14FBAAccLA$1,530,948-0.25.82
15FBABOAMDU$S252,621-0.34-3.98
16FBABonAA$1,140,3190.80.38
17FBACalifA$4,386,371-0.56-3.78
18FBAEEUU$1,243,506-0.664.02
19FBAEUROP$1,510,732-0.610.23
20FBAHORIZ$2,012,6040.44-4.71
21FBARENMP$2,281,9590.020.36
22
23
24
25FechaConsultaFechaCotizac.FBAAHOMPFBAAccGlAFBAAccLAFBABOAMDFBABonAAFBACalifAFBAEEUUFBAEUROPFBAHORIZFBARENMP
2630/07/200727/07/20070.5-0.54-0.2-0.340.8-0.56-0.66-0.610.440.02
Cierre cotizacion



He aqui la pagina donde se guarda la info.
 
Upvote 0
Code:
Sub Test()
    
    Set ie = CreateObject("InternetExplorer.Application")
    With ie
        .Visible = True
        .Navigate "https://hb.bbv.com.ar/hbbf/FondosSC.jsp"

        Do Until .ReadyState = 4: DoEvents: Loop
        Set doc = ie.Document
        GetOneTable doc, 4
        .Quit
    End With

End Sub


Sub GetOneTable(d, n)
' d is the document
' n is the table to extract
Dim e As Object ' the elements of the document
Dim t As Object ' the table required
Dim r As Object ' the rows of the table
Dim c As Object ' the cells of the rows.
Dim I As Long
Dim J As Long

    For Each e In d.all
        If e.nodename = "TABLE" Then
            J = J + 1
        End If
        If J = n Then
            Set t = e
    
            tabno = tabno + 1
            nextrow = nextrow + 1
            Set rng = Range("A" & nextrow)
            For Each r In t.Rows
                For Each c In r.Cells
                    rng.Value = c.innertext
                    Set rng = rng.Offset(, 1)
                    I = I + 1
                Next c
                nextrow = nextrow + 1
                Set rng = rng.Offset(1, -I)
                I = 0
            Next r
            Exit For
        End If
    
    Next e
    
End Sub
 
Upvote 0
Mucha gracias Norie!! Guardar la tabla con el codigo que expusiste es mucho mas prolijo !!

En el codigo encontre muchas palabras que no encuentro en la ayuda de VBA, me puedes guiar de donde leer para aprender sobre ellas?
Ah, una consultita: como hiciste para saber que la tabla que tiene la info es la numero 4?

Lo traduzco por si acaso:
I translate this just in case:
Thanks a lot Norie! Saving the table with your code is much more prolix than the one I was using!!
Still I found a lot new words I cannot find in the VBA HELP (i.e.: nodename, innertext), could you tell me where to read so I can learn more about this subject?
One little question: how did you quarrel that the table which has the info in the 4th one?




Saludos,
Miguel.
 
Upvote 0
Miguel

Glad to help, sorry I can't reply in your own tongue.:)

I found the 4 by looking at the page's HTML source, which you can do in IE by going to View>Source.

There I found that the data you wanted was in the 4th table.

Most of the code I've done for automating IE via VBA has been helped by this link.

Again I apologize for replying in English and I hope I've not broken any rules.:)
 
Upvote 0
Gente: traduzco lo que contesto Norie por si alguien está siguiendo el post:

Norie escribió:

Miguel

Me alegra ayudar, es una lastima que no pueda responder en tu misma lengua. :)

Encontré que era la tabla Nº 4 viendo el codigo fuente de la pagina (en IE lo ves en Ver->Codigo Fuente)
Asi fue como encontré el numero 4.

Casi todo lo que programé para automatizar IE via VBA fue con la ayuda de este link http://msdn2.microsoft.com/en-us/library/ms533050.aspx
De nuevo me disculpo por responder en ingles y espero no haber quebrado ninguna regla. :)

Bueno, ahora me queda agradecer a Norie por su ayuda y a comenzar a leer el link que nos compartió.
Saludos!

Thanks a lot Norie, I am starting to read now the information you shared with us.
Thanks a lot!!!
Greetings, Miguel.
 
Upvote 0

Forum statistics

Threads
1,214,630
Messages
6,120,634
Members
448,973
Latest member
ChristineC

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top