如何从csv文件复制空白?

时间:2019-06-24 07:16:17

标签: excel vba csv

我希望执行交易,但有时没有数据要复制“此空白”以将其放置在excel工作表中,因为否则我的剪贴板中总是存在先前的交易。

   Sub OpenCSVFile()
    '
    ' Load the CSV extract
    '

    '
      With ActiveSheet.QueryTables.Add(Connection:= _
      "TEXT;" & fpath & "\" & ffilename, Destination:=Range("$A$1"))
     .Name = "text"
      .FieldNames = True
      .RowNumbers = False
      .FillAdjacentFormulas = False
      .PreserveFormatting = True
      .RefreshOnFileOpen = False
      .RefreshStyle = xlInsertDeleteCells
      .SavePassword = False
      .SaveData = True
      .AdjustColumnWidth = True
      .RefreshPeriod = 0
      .TextFilePromptOnRefresh = False
      .TextFilePlatform = 850
      .TextFileStartRow = 1
      .TextFileParseType = xlDelimited
      .TextFileTextQualifier = xlTextQualifierDoubleQuote
      .TextFileConsecutiveDelimiter = False
      .TextFileTabDelimiter = True
      .TextFileSemicolonDelimiter = False
       .TextFileCommaDelimiter = False
      .TextFileSpaceDelimiter = False
     .TextFileOtherDelimiter = "|"
     .TextFileColumnDataTypes = Array(1)
     .TextFileTrailingMinusNumbers = True
     .Refresh BackgroundQuery:=False

    End With
    End Sub

   Sub StartExtract()

   ' Set the sid and client to connect to
   W_System = "P10320"
   ' Run the GUI script
    RunGUIScript
   ' End the GUI session
    objSess.EndTransaction
    'effacer contenu feuille temp
    Sheets("temp").Select
    Cells.Select
    Selection.Delete Shift:=xlUp
    'Switch to the worksheet where the data is loaded to
   Sheets("temp").Select

   'Load the CSV file
    OpenCSVFile

    End Sub 

错误始终在此处“ .Refresh BackgroundQuery:= False”

0 个答案:

没有答案