我想在特定文件夹中创建一个文本文件。使用浏览按钮选择文件夹路径,路径将存储在字符串变量中。现在我想在该路径中创建一个文本文件,我想使用Print #
语句写入它。
Sub textfile()
Dim FilePath As String
'What is the file path
FilePath = "C:\Users\Chandu\Desktop\VBA\"
'Now I want to create a text file like temp.h in the above path.
Open "FilePath &""temp.h"" For Output As TextFile `enter code here`
'Write some lines of text
Print #1, "entering into VBA"
Close #1
End Sub