VBA 代码如下:
Dim a,b
a = "11.00% 22.00%"
b = "11.00% | 22.00%"
Application.MsgOut a
Application.MsgOut b
Call Document.DebugFile("D:\test2.txt", a, 1)
Call Document.DebugFile("D:\test2.txt", b, 1)
运行结果:
Application.MsgOut 输出:
11.00% 22.00%
11.00% | 22.00%
Document.DebugFile 输出到文件D:\test2.txt内容:
2018-09-24 13:46:22.587 11.00%
2018-09-24 13:46:22.588 11.00| 22.00
似乎Document.DebugFile 在处理某些特殊字符,比如百分号时有问题。
这应该是Document.DebugFile本身的问题吧,为什么Document.DebugFile 自己不能正确处理百分号?
写log字符串大多都是变量,写log之前还要检查一下字符串里面有没有百分号?然后还要做一堆特殊处理?还不如自己写文件算了,也还不知道有没有其他字符也不能正常处理?
你们文档也没说这个Document.DebugFile有这些毛病。
[此贴子已经被作者于2018/9/28 17:02:46编辑过]