当我在记事本中查看文件时,我正在将txt文件和第一行中的第一个字符写入双引号。如果我检查代码运行时写出的变量,则双引号不存在。任何想法可能有什么问题吗?这是我的代码段:
mydata1 = "!TRNS" & vbTab & vbTab & "TRNSID" & vbTab & "TRNSTYPE" & vbTab &
"DATE" & vbTab & "ACCNT" & vbTab & "CLASS" & vbTab & "AMOUNT" & vbTab &
"DOCNUM" & vbTab & "MEMO" & vbCrLf
mydata1 = mydata1 & "!SPL" & vbTab & "SPLID" & vbTab & "TRNSTYPE" & vbTab &
"DATE" & vbTab & "ACCNT" & vbTab & "CLASS" & vbTab & "AMOUNT" & vbTab &
"DOCNUM" & vbTab & "MEMO" & vbCrLf
mydata1 = mydata1 & "!ENDTRNS" & vbTab & vbTab & vbTab & vbTab & vbTab &
vbTab & vbTab & vbTab & vbCrLf
mydata1 = mydata1 & "TRNS" & vbTab & "GENERAL JOURNAL" & vbTab & myDate &
vbTab & "ACCOUNTS REC-CORP OFFICE" & vbTab & "CORPORATE OFFICE" & vbTab &
mytot & vbTab & myDate & vbTab & vbCrLf
mydata1 = mydata1 & mydata2
file = "d:\junk\todd\tester.txt"
Open myfile For Output As #1
Write #1, mydata1
Close #1
答案 0 :(得分:1)
您可以使用以下语法,看看它是否对您有用:
Print #1, mydata1
顺便说一句,变量myfile和file在您的代码中不匹配。