我在保存到.csv之前遇到了类似的问题,除了所有数据都会移到A列。这次它会在每个逗号的列中传播出来。我的列表分隔符设置为分号,因为我的描述包含逗号。保存为.csv时的解决方案是将Local设置为True。我在下面使用的代码是将.csv文件保存为.xlsx,因此我可以对其执行操作,例如删除数据之间的空行。尝试对.csv文件执行此操作,但它无法正常工作。下面的第一张图片是.csv,第二张是我将它保存为.xlsx时会发生的事情。
Dim CSVFILE As Workbook
Application.DisplayAlerts = False
Set CSVFILE = Workbooks.Open("C:DOORS_COMBINED.grouped.csv")
CSVFILE.SaveAs FileName:="C:DOORS_COMBINED.grouped.xlsx", _
FileFormat:=51, CreateBackup:=False, local:=True
Workbooks("DOORS_COMBINED.grouped.xlsx").Close
答案 0 :(得分:0)
Private Sub XLSMSAVEBTN_Click()
Dim myfile As Workbook
Application.DisplayAlerts = False
Workbooks.OpenText FileName:= _
"C:\Users\Geoffrey\Dropbox\DCS PROGRAM\FILES\1. QUOTES\3. PROGRAM FILES\DOOR QT REQUESTS\DOORS_COMBINED.grouped.csv"
Set myfile = ActiveWorkbook
myfile.SaveAs FileName:="C:\Users\Geoffrey\Dropbox\DCS PROGRAM\FILES\1. QUOTES\3. PROGRAM FILES\DOOR QT REQUESTS\DOORS_COMBINED.grouped.xlsx", _
FileFormat:=51, CreateBackup:=False, local:=True
Workbooks("DOORS_COMBINED.grouped.xlsx").Close
End Sub