vb在指定程序保存的目录下创建指定名称的txt并将#1文件内容写入这个txt并保存在这个文件夹中

最好用上filelistbox!

Dim strPath$, strFileName$, strTmp$, iSeq%
strPath = App.Path & "\" '当前目录
strTmp = Text1.Text '文件名称
strFileName = strPath & strTmp & ".Txt" '假设文件类型为TXT文本文件
iSeq = 0 '文件序号
Do While Dir(strFileName) <> ""
iSeq = iSeq + 1
strTmp = Text1.Text & CStr(iSeq)
strFileName = strPath & strTmp & ".Txt" '假设文件类型为TXT文本文件
Loop

Dim iFn%
iFn = FreeFile
Open strFileName For Output As iFn
Print #iFn, Text1.Text & CStr(iSeq) '写入文件内容
Close #iFn
温馨提示:答案为网友推荐,仅供参考
相似回答