Hi all.
I have a problem with a dir in vba script for excel. This is the code.
Than it displays the text file that i do have for testing this and works grate. Then i have the exact same file on a server so then i tried this:
Then i get output of "To had code.txt" and there is no such fiel on that folder there is only the 1 text file that is named Test.txt. Then i mapped a drive to that folder and still did not work. Must i do something else?
Tnx allot
I have a problem with a dir in vba script for excel. This is the code.
Code:
Sub FileName()
Dim sFil As String
Dim sPath As String
sPath = "C:\"
ChDir sPath
sFil = Dir("*.txt")
Do While sFil <> ""
Sheet1.Range("A1") = sFil
sFil = Dir
Loop
End Sub
Than it displays the text file that i do have for testing this and works grate. Then i have the exact same file on a server so then i tried this:
Code:
Sub FileName()
Dim sFil As String
Dim sPath As String
sPath = "\\mrmprd02\TRMFeeds\Today\IAFeeds"
ChDir sPath
sFil = Dir("*.txt")
Do While sFil <> ""
Sheet1.Range("A1") = sFil
sFil = Dir
Loop
End Sub
Then i get output of "To had code.txt" and there is no such fiel on that folder there is only the 1 text file that is named Test.txt. Then i mapped a drive to that folder and still did not work. Must i do something else?
Tnx allot