,可以通过以下步骤实现:
Dim fso As Object
Dim file As Object
Dim filePath As String
Set fso = CreateObject("Scripting.FileSystemObject")
filePath = "C:\path\to\file.csv"
Set file = fso.OpenTextFile(filePath, 1)
Dim line As String
Do Until file.AtEndOfStream
line = file.ReadLine
' 在这里进行双引号的删除操作
Loop
line = Replace(line, """", "")
完整的代码示例如下:
Dim fso As Object
Dim file As Object
Dim filePath As String
Dim line As String
Set fso = CreateObject("Scripting.FileSystemObject")
filePath = "C:\path\to\file.csv"
Set file = fso.OpenTextFile(filePath, 1)
Do Until file.AtEndOfStream
line = file.ReadLine
line = Replace(line, """", "")
' 在这里进行进一步的操作
Loop
file.Close
Set file = Nothing
Set fso = Nothing
这样,通过以上步骤,你可以在VBA中读取CSV文件时删除双引号。
领取专属 10元无门槛券
手把手带您无忧上云