Excel 2013 VBA 添加奇怪的引号
Excel 2013 VBA adding strange quotes
假设
Sub test()
Worksheets("1").Cells(1, 1).Value = "html"
Worksheets("1").Cells(1, 2).Value = "<xml xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" > "
txt = " '" & Worksheets("1").Cells(1, 1) & "'=>array('" & Worksheets("1").Cells(1, 2) & "' => $" & Worksheets("1").Cells(1, 1) & "),"
MsgBox txt
FilePath = Application.DefaultFilePath & "\array.txt"
Open FilePath For Output As #2
Write #2, txt
Close #2
End Sub
现在将 msgbox 输出与 array.txt 文件进行比较。
所以我所有的 txt 字符串都被引用了,还向 url 添加了额外的引号,如何防止更改并按原样获取字符串。
问题是如何将 msgbox 输出放入 array.txt?
Sub test()
Worksheets("1").Cells(1, 1).Value = "html"
Worksheets("1").Cells(1, 2).Value = "<xml xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" > "
txt = " '" & Worksheets("1").Cells(1, 1) & "'=>array('" & Worksheets("1").Cells(1, 2) & "' => $" & Worksheets("1").Cells(1, 1) & "),"
MsgBox txt
FilePath = Application.DefaultFilePath & "\array.txt"
Open FilePath For Output As #2
Print #2, txt
Close #2
End Sub
假设
Sub test()
Worksheets("1").Cells(1, 1).Value = "html"
Worksheets("1").Cells(1, 2).Value = "<xml xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" > "
txt = " '" & Worksheets("1").Cells(1, 1) & "'=>array('" & Worksheets("1").Cells(1, 2) & "' => $" & Worksheets("1").Cells(1, 1) & "),"
MsgBox txt
FilePath = Application.DefaultFilePath & "\array.txt"
Open FilePath For Output As #2
Write #2, txt
Close #2
End Sub
现在将 msgbox 输出与 array.txt 文件进行比较。
所以我所有的 txt 字符串都被引用了,还向 url 添加了额外的引号,如何防止更改并按原样获取字符串。
问题是如何将 msgbox 输出放入 array.txt?
Sub test()
Worksheets("1").Cells(1, 1).Value = "html"
Worksheets("1").Cells(1, 2).Value = "<xml xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" > "
txt = " '" & Worksheets("1").Cells(1, 1) & "'=>array('" & Worksheets("1").Cells(1, 2) & "' => $" & Worksheets("1").Cells(1, 1) & "),"
MsgBox txt
FilePath = Application.DefaultFilePath & "\array.txt"
Open FilePath For Output As #2
Print #2, txt
Close #2
End Sub