我的代码的单元格C18是文件路径
C:\blahblahblah\yay.db
我想写一个txt文件,所以第一行是:
uil_file_new.go( "C:\blahblahblah\yay.db","C:\blahblahblah\yay.db")
我尝试了以下内容:
Dim template As String
template = Range("C18").Value
Open (ThisWorkbook.Path & "\" & "test.txt") For Output Access Write Shared as #1
Print #1, "uil_file_new.go( " & template & "," & template & ")"
Close #1
给出了
uil_file_new.go( C:\blahblahblah\yay.db ,C:\blahblahblah\yay.db)
我需要txt文件在文件路径周围加上“”。有没有办法将变量传递给txt文件,但是变量包含的变量是什么?
我尝试过写#1命令,但它只是放了“模板”,这不是我想要的。
它不会让我写单“,例如这样就可以了:
Write #1, "
Print #1, template
Write #1, "
但它始终将其更正为
Write #1, ""
答案 0 :(得分:2)
要打印"
,请将它们加倍""
;
Print #1, "uil_file_new.go(""" & template & """,""" & template & """)"