Sub CWSSCheck()
If ActiveSheet.Name = "Position_by_Fixture" Then
Call FileCheck
ElseIf ActiveSheet.Name = "Group_PositionList" Then
MsgBox "This is the Group Position List. Convert the Shelfstock to the old
format using the 'Convert Shelfstock' function and try again.", vbExclamation, "Invalid Format"
Else
MsgBox "This workbook doesn't have a Shelfstock sheet. Please open a valid Shelfstock file and try again.", vbExclamation, "Shelfstock Not Found"
End If
End Sub
Sub FileCheck()
'Check the REQUIRED FILES folder
UserForm1.Show
Dim RFPath As String
Dim UOLPath As String
Dim SOLPath As String
RFPath = ""
On Error Resume Next
RFPath = Environ("USERPROFILE") & "\Desktop\REQUIRED FILES\"
On Error GoTo 0
UOLPath = ""
On Error Resume Next
UOLPath = Environ("USERPROFILE") & "\Desktop\REQUIRED FILES\UPDATED_OUTLET_LIST.xlsx"
On Error GoTo 0
SOLPath = ""
On Error Resume Next
SOLPath = Environ("USERPROFILE") & "\Desktop\REQUIRED FILES\SAP_OUTLET_LIST.xlsx"
On Error GoTo 0
If RFPath = "" Then
UserForm1.CheckBox3.Value = False
Else
UserForm1.CheckBox3.Value = True
End If
If SOLPath = "" Then
UserForm1.CheckBox2.Value = False
Else
UserForm1.CheckBox2.Value = True
End If
If UOLPath = "" Then
UserForm1.CheckBox1.Value = False
Else
UserForm1.CheckBox1.Value = True
End
End Sub
I wrote the following code to check for a folder in the user's desktop and two files inside that folder and then update three checkboxes in a userform.
But every time i run this i get different results regardless the availability of the files in the said folder. The code seems to be checking the checkboxes at random.
I'm having a hard time seeing what's wrong with the code. Any help would be appreciated!