我需要连接到一个网站,凭据凭据然后单击一个链接并获取它带到我的Excel工作表的表 .

我已经登录了该站点并使用以下代码更新了表格,但这仅在excel“from web”连接存活时才有效 . 我的意思是,首先我必须更新DATA-FROM WEB连接刷新凭据,然后运行宏 .

虽然总是可以访问和更新Web表,但如果该连接在一小时前更新,则无法将其粘贴到Excel工作表 .

这是代码:

Sub Descargar_tabla()

  Dim IE As Object

  Set IE = CreateObject("WScript.Shell")

   IE.Run ("""C:\Program Files (x86)\Opera\launcher.exe"" ""https://clientes.invertirenbolsa.com.ar/cart.aspx""")

   With ActiveSheet.QueryTables.Add(Connection:="URL;https://clientes.invertirenbolsa.com.ar/cart.aspx", Destination:=Range("$L$40"))
       ' .Name = "cart"
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = False
        .RefreshOnFileOpen = False
        .BackgroundQuery = True
        .RefreshStyle = xlOverwriteCells
        .SavePassword = True
        .SaveData = True
        .AdjustColumnWidth = False
        .RefreshPeriod = 0
        .WebSelectionType = xlSpecifiedTables
        .WebFormatting = xlWebFormattingNone
        .WebTables = "2"
        .WebPreFormattedTextToColumns = True
        .WebConsecutiveDelimitersAsOne = True
        .WebSingleBlockTextImport = False
        .WebDisableDateRecognition = False
        .WebDisableRedirections = False
        .Refresh BackgroundQuery:=True
        Set IE = Nothing

    End With
End Sub

我应该在代码中添加什么来使用我已经在浏览器中没有过期的网站开放会话?