小编XDS*_*IOP的帖子

如何用vba删除txt文件的内容?

我想与 SAP 进行交易,我使用 csv 文件作为导出文件,但最后我想删除此文件的内容而不删除文件本身。删除内容就行了。

      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 …
Run Code Online (Sandbox Code Playgroud)

excel vba

3
推荐指数
1
解决办法
3408
查看次数

标签 统计

excel ×1

vba ×1