January 30, 2020
Afternoon,
I have a program where if the file opens itshould indicate in a folder InUseYES.txt using the code.
FileControllerFolder & FileControlSubfolder
If "\InUseYes.txt" then Thisworkbook.Close dont Save.
However, even though I created the folders H:\PROJECT-OPS\MultipleUsersIssue\FilesInUse and have a txt file InUseNO_.txt the error comes up Runtime error 53 File Not Found????
The offending error is below
Name FileControlFolder & FileControlSubFolder & _
"\InUse_NO.txt" As FileControlFolder & FileControlSubFolder & "\InUse_YES.txt"
Does excel see the "\ . I have tried many other ways to see the file to avail.
Can anyone help me on this code
I attach the file
Thanks
Trusted Members
Moderators
November 1, 2018
Trusted Members
Moderators
November 1, 2018
January 30, 2020
Yes Sorry Velouria ...Stupid spell checker!
Yes I do have H:\PROJECT-OPS\MultipleUsersIssue\FilesInUse\Test
It looks as though I found how this code works
1. I needed to put the file Test in the FilesInUse Folder in order to see this file to work
2. InUse_YES now works and subsequently InUse_NO when I close
HOWEVER!!!!.
The TextFile_Create (FileControlFolder & FileControlSubFolder & "\" & Environ("UserName") & ".txt") - Does not input username but it does input MyFile in the test folder.
Which is :
Sub TextFile_Create(FilePath As String)
'PURPOSE: Create A New Text File
'Adapted from: http://www.TheSpreadsheetGuru.com
Dim TextFile As Integer
'What is the file path and name for the new text file?
FilePath = "H:\PROJECT-OPS\MultipleUsersIssue\FilesInUse\Test\MyFile.txt"
'Determine the next file number available for use by the FileOpen function
TextFile = FreeFile
'Open the text file
Open FilePath For Output As TextFile
'Save & Close Text File
Close TextFile
End Sub
Thanks
Steve
1 Guest(s)