mmn1000
Board Regular
- Joined
- Mar 17, 2020
- Messages
- 78
- Office Version
- 2019
- 2013
- Platform
- Windows
Hi,
I create a file in the folder using the following code
If the F100.txt file is available in the Data folder, write the name F100 in cell A1 of the sheet and write the word "available" in A2.
If the F100.txt file is not available, create a file in the Data folder and write the word "F100.txt file created" in cell A2.
I create a file in the folder using the following code
VBA Code:
[COLOR=rgb(85, 57, 130)][SIZE=5][B][/B][/SIZE][/COLOR]
Sub CreateTxtFile()
directory = "D:\Data\"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.CreateTextFile(directory & "F100.txt ")
End Sub
If the F100.txt file is available in the Data folder, write the name F100 in cell A1 of the sheet and write the word "available" in A2.
If the F100.txt file is not available, create a file in the Data folder and write the word "F100.txt file created" in cell A2.