Hi,
I have around 60 folders on a shared network that various people are going to save files into. I need a way to check if they have saved the files in their folder. So I tried the below code and it worked:
Now I am trying to link parts of the Strpath to cells in the worksheet so that I can change the path from the sheet and check a specific folder I want. I tried the below but its not working:
The values in O1 is 1. July and in O2 it is \Botswana\
What am I doing wrong?
Also is there a way I could set it up so that the result (message in msgbox) gets pasted in a specific cell rather than doing a message box?
Please assist.
I have around 60 folders on a shared network that various people are going to save files into. I need a way to check if they have saved the files in their folder. So I tried the below code and it worked:
Code:
Strpath = "P:\SARS\2017 Financial year\1. July\Botswana\"
If Right(Strpath, 1) <> "\" Then
Strpath = Strpath & "\"
End If
If Dir(Strpath & "*.*") = "" Then
MsgBox "The folder doesn't contain files"
Else
MsgBox "The folder does contain files"
End If
Now I am trying to link parts of the Strpath to cells in the worksheet so that I can change the path from the sheet and check a specific folder I want. I tried the below but its not working:
Code:
Name = ThisWorkbook.Sheets("Sheet1").Range("O2").Value
Name1 = ThisWorkbook.Sheets("Sheet1").Range("O3").Value
Strpath = "P:\SARS\2017 Financial year\" & Name & Name1
If Right(Strpath, 1) <> "\" Then
Strpath = Strpath & "\"
End If
If Dir(Strpath & "*.*") = "" Then
MsgBox "The folder doesn't contain files"
Else
MsgBox "The folder does contain files"
End If
The values in O1 is 1. July and in O2 it is \Botswana\
What am I doing wrong?
Also is there a way I could set it up so that the result (message in msgbox) gets pasted in a specific cell rather than doing a message box?
Please assist.