mmn1000
Board Regular
- Joined
- Mar 17, 2020
- Messages
- 78
- Office Version
- 2019
- 2013
- Platform
- Windows
Hi,
dear professors and friends, I have a question, please help me
I create a file in the folder using the following code
I want to check this code. If the F100.txt file is available in the Data folder, write the name of F100 in cell A1 of the sheet and write the word "Available" in A2.
If the F100.txt file does not exist in the Data folder, create a file and write the word "file created" in cell A2.
dear professors and friends, I have a question, please help me
I create a file in the folder using the following code
VBA Code:
Sub CreateTxtFile()
directory = "D:\Data\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(directory & "F100.txt ")
End Sub
If the F100.txt file does not exist in the Data folder, create a file and write the word "file created" in cell A2.
Last edited by a moderator: