'写入txt文件,要求事先建立D:\dk.txt文件 Set Opentxt = CreateObject("Scripting.FileSystemObject") Set a = Opentxt.CreateTextFile("D:\dk.txt", True) For num = 1 To N a.writeline (x(num) & " " & y(num)) Rightstr = Rightstr + 1 Next num a.Close 问题是:能否不需要事先建立文件,由vba创建文件呢? |