Ver Mensaje Individual
  #5 (permalink)  
Antiguo 23/01/2012, 11:10
noblejis
 
Fecha de Ingreso: abril-2008
Mensajes: 40
Antigüedad: 16 años
Puntos: 2
Respuesta: [AYUDA]Publicar hoja excel 2003 en web de forma automática

He encontrado como hacerlo desde vba. El usuario y clave se pasan utilizando ActiveSheet.PostText, pero no consigo hacerlo funcionar....

Código:
Sub ConsultaWeb()
'
' ConsultaWeb Macro
'

'

Const user = "mi usuario"
Const pass = "mi clave"

    For Each Q In ActiveSheet.QueryTables
        Q.Delete
    Next Q
    ActiveSheet.Cells.Clear
    
    With ActiveSheet.QueryTables.Add(Connection:="URL;http://www.miwebdelogueo.com/index.jsp", Destination:=Range("$A$1"))
        .PostText = "user=" & user & "&pass=" & pass
        .Refresh BackgroundQuery:=False
        
        .Connection = "URL;http://www.miwebconlosdatos.com/datos.jsp"
        .Name = "datos.jsp"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 60
        .WebSelectionType = xlEntirePage
        .WebFormatting = xlWebFormattingNone
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=False
    End With
    Range("A2").Select
    
End Sub