Runtime Error 1004

Anonimo
2016-10-25T09:45:05+00:00

Ciao a tutti,

ho da poco migrato il mio office aziendale dal 2007 al 2016.

Ho una routine Excel che ora non funziona più.

Il frammento di codice è:

objXL.Sheets.Add.Name = "RIEPILOGO"

With objXL.ActiveSheet.QueryTables.Add(Connection:="URL;http://www.amvendors.com/vendors/ASN/Default.aspx", Destination:=objXL.ActiveSheet.Range("$A$1"))

    .Name = "TTT"           '"q?s=goog_2"

    .FieldNames = False

    .RowNumbers = True

    .FillAdjacentFormulas = False

    .PreserveFormatting = True

    .RefreshOnFileOpen = False

    .BackgroundQuery = True

    .RefreshStyle = xlInsertDeleteCells

    .SavePassword = False

    .SaveData = True

    .AdjustColumnWidth = True

    .RefreshPeriod = 0

    .WebSelectionType = xlSpecifiedTables

    .WebFormatting = xlWebFormattingNone

    .WebTables = "1,2"

    .WebPreFormattedTextToColumns = True

    .WebConsecutiveDelimitersAsOne = True

    .WebSingleBlockTextImport = False

    .WebDisableDateRecognition = False

    .WebDisableRedirections = False

    .Refresh BackgroundQuery:=True

End With

Il messaggio di errore che ricevo è:

Errore di run-time '1004':

Non è possibile aprire http://www.amvendors.com/vendors/ASN/Default.aspx. Collegamento ipertestuale interrotto.

Qualcuno potrebbe aiutarmi?

Grazie mille.

Microsoft 365 e Office | Excel | Per la casa | Windows

Domanda bloccata. Questa domanda è stata eseguita dalla community del supporto tecnico Microsoft. È possibile votare se è utile, ma non è possibile aggiungere commenti o risposte o seguire la domanda.

0 commenti Nessun commento

7 risposte

Ordina per: Più utili
  1. Anonimo
    2017-02-11T03:43:07+00:00

    Ciao Giuseppe.

    il problema lo riscontro anche avviando excel come amministratore.

    La riga che viene evidenziata è: .Refresh BackgroundQuery:=True

    Prova qualcosa del genere:

    '=========>>

    Option Explicit

    '--------->>

    Public Sub Tester()

        Dim WB As Workbook

        Dim SH As Worksheet

        Dim oConn As WorkbookConnection

         Set WB = ThisWorkbook

        With WB

            Set SH = .Sheets.Add

            SH.Name = "RIEPILOGO"

            For Each oConn In .Connections

                oConn.Delete

            Next oConn

        End With

        With SH.QueryTables.Add( _

             Connection:= _

             "URL;http://www.amvendors.com/vendors/ASN/Default.aspx", _

             Destination:=SH.Range("$A$1"))

            .Name = "TTT"

            .FieldNames = False

            .RowNumbers = True

            .FillAdjacentFormulas = False

            .PreserveFormatting = True

            .RefreshOnFileOpen = False

            .BackgroundQuery = True

            .RefreshStyle = xlInsertDeleteCells

            .SavePassword = False

            .SaveData = True

            .AdjustColumnWidth = True

            .RefreshPeriod = 0

            .WebSelectionType = xlSpecifiedTables

            .WebFormatting = xlWebFormattingNone

            .WebTables = "1,2"

            .WebPreFormattedTextToColumns = True

            .WebConsecutiveDelimitersAsOne = True

            .WebSingleBlockTextImport = False

            .WebDisableDateRecognition = False

            .WebDisableRedirections = False

            On Error Resume Next

            .Refresh

            On Error GoTo 0

        End With

    End Sub

    '<<=========

    ===

    Regards,

    Norman

    La risposta è stata utile?

    0 commenti Nessun commento
  2. Anonimo
    2017-02-06T09:31:29+00:00

    Ciao,

    il problema lo riscontro anche avviando excel come amministratore.

    La riga che viene evidenziata è: .Refresh BackgroundQuery:=True

    La risposta è stata utile?

    0 commenti Nessun commento