它不会插入所有行(VBA)

时间:2018-07-02 12:05:49

标签: excel-vba insert vba excel

我想从文件的第1.000.000行开始插入一个巨大的文件(总行号为1.337.550),但它仅插入48578行。为什么,以及如何插入从1.000.000起的所有行(以这种方式或其他方式)?

Sub Inserter()

    Dim ConOrg As String
    ConOrg = "TEXT;" & Cells(1, 4).Value & "\" & Cells(i, 1).Value

    Sheets.Add(After:=Sheets(Sheets.Count)).Name = "support"

    With ActiveSheet.QueryTables.Add(Connection:= ConOrg, Destination:=Cells(1, 1))
        .Name = filename
        .FieldNames = True
        .RowNumbers = False
        .FillAdjacentFormulas = False
        .PreserveFormatting = True
        .RefreshOnFileOpen = False
        .RefreshStyle = xlInsertDeleteCells
        .SavePassword = False
        .SaveData = True
        .AdjustColumnWidth = True
        .RefreshPeriod = 0
        .TextFilePromptOnRefresh = False
        .TextFileStartRow = 1000000
        .TextFileParseType = xlDelimited
        .TextFileTextQualifier = xlTextQualifierDoubleQuote
        .TextFileConsecutiveDelimiter = True
        .TextFileTabDelimiter = True
        .TextFileSemicolonDelimiter = False
        .TextFileCommaDelimiter = False
        .TextFileSpaceDelimiter = False
        .TextFileColumnDataTypes = Array(1, 9, 9, 9, 9, 9, 9, 9)
        .TextFileTrailingMinusNumbers = True
        .Refresh BackgroundQuery:=False
    End With

End Sub

0 个答案:

没有答案