Learn when you want, where you want with convenient online training courses. Sign up now!
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
APIAllFiles = sAns
Private Function StripNull(ByVal InString As String) As String
'Input: String containing null terminator (Chr(0))
'Returns: all character before the null terminator
Dim iNull As Integer
If Len(InString) > 0 Then
iNull = InStr(InString, vbNullChar)
Select Case iNull
StripNull = InString
StripNull = ""
StripNull = Left$(InString, iNull - 1)
Public Function isDirectory(FileAttr As Long) As Boolean
Dim bAns As Boolean
Dim lDir As Long
Dim lHidden As Long
Dim lSystem As Long
Dim lReadOnly As Long
lDir = FILE_ATTRIBUTE_DIRECTORY
lHidden = FILE_ATTRIBUTE_HIDDEN
lSystem = FILE_ATTRIBUTE_SYSTEM
lReadOnly = FILE_ATTRIBUTE_READONLY
isDirectory = FileAttr = lDir Or FileAttr = _
lDir + lHidden Or FileAttr = lDir + lSystem _
Or FileAttr = lDir + lReadOnly Or FileAttr = _
lDir + lHidden + lSystem Or FileAttr = _
lDir + lHidden + lReadOnly Or FileAttr = _
lDir + lSystem + lReadOnly Or _
FileAttr = lDir + lSystem + lHidden + lReadOnly
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFolder = objFSO.GetFolder("D:\")
For Each file in objFolder.Files
If Instr(ucase(Right(file,3)),"TXT") Then
set objFile = objFSO.OpenTextFile(file)
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.