我正在尝试使用vba将excel列导出到txt。 但是每个文本中都有一些额外的双引号。 如何删除多余的双引号??
Dim field As String
Dim table As String
Dim t As Integer
Dim f As Integer
Dim lastrow As Integer
Dim myFile As String
Dim xStr As String
myFile = "D:\table.txt"
With Sheets("Sheet1")
Open myFile For Output As #1
table = """name"": """ & .Range("I2") & """," & Chr(10)
Write #1, table
lastrow = Range("A" & Rows.Count).End(xlUp).Row
For f = 2 To lastrow
field = """names"": [" & Chr(10) & """" & .Range("B" & f) & """" & Chr(10) & _
"],"
'Display 3 Lines of Text in a Messagebox
Write #1, field
' Cells(i, 1).Value = 100
Next f
Close #1
End With
我希望输出 “ name”:“客户”,
但是输出是: “”“名称”“:”“客户”“,
答案 0 :(得分:1)
使用Print
而不是Write
(添加"
)