vba 从vba中的write语句中删除双引号
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20016895/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Remove double quotation from write statement in vba
提问by user1902849
This code will write log file to LogFilePath, and generate output as below. StarRange and EndRange is a variable which value will populate from other function.
此代码将日志文件写入 LogFilePath,并生成如下输出。StarRange 和 EndRange 是一个变量,其值将从其他函数填充。
"Start postion",A1
"End position",B100
---Code-----------------
Sub WriteLogFile()
Dim FilePath As String
LogFilePath = WriteTextBox.Text
LogFilePath = LogFilePath & ".log"
Open LogFilePath For Output As #2
Write #2, "Start postion"; StarRange
Write #2, "End position"; EndRange
Close #2
MsgBox FinalFileName
End Sub
My question is how can I remove double quotation mark from output and produce output as below. Thanks
我的问题是如何从输出中删除双引号并产生如下输出。谢谢
Start position = A1
End position = B100
回答by GSerg
Write
is a special statement designed to generate machine-readable files that are later consumed with Input
.
Write
是一个特殊的语句,旨在生成机器可读的文件,这些文件稍后会与Input
.
Use Print
to avoid any fiddling with data.
使用Print
以避免与数据的任何摆弄。
Print #2, "Start postion = "; StarRange
Print #2, "End position = "; EndRange