I am going through a directory and grabbing the folder names 4 deep and then grabbing the filename. I am having problems when it goes back up the go to the next folder I am getting an error message "Invalid procedure call or argument". I think it is because I have already called the Dir.
Thanks
Shannon
VB Code:
Private Function GetClient(iPath As String) As String Dim MyDir Dim MyClient As String MyClient = Dir(iPath, vbDirectory) Do While MyClient <> "" If MyClient <> "." And MyClient <> ".." Then If (GetAttr(iPath & MyClient) And vbDirectory) = vbDirectory Then Debug.Print MyClient Call GetCategory(iPath & MyClient & "\") End If End If MyClient = Dir Loop End Function Private Sub Form_Activate() Call GetClient("\\192.168.75.120\staging\") End Sub Private Function GetCategory(MyClient As String) As String Dim MyDir1 Dim MyCategory As String MyCategory = Dir(MyClient, vbDirectory) Do While MyCategory <> "" If MyCategory <> "." And MyCategory <> ".." Then If (GetAttr(MyClient & MyCategory) And vbDirectory) = vbDirectory Then Debug.Print MyClient & MyCategory Call GetSource(MyClient & MyCategory & "\") End If End If MyCategory = Dir Loop End Function Private Function GetSource(MyCategory As String) As String Dim MyDir2 Dim MySource As String MySource = Dir(MyCategory, vbDirectory) Do While MySource <> "" If MySource <> "." And MySource <> ".." Then If (GetAttr(MyCategory & MySource) And vbDirectory) = vbDirectory Then Debug.Print MyCategory & MySource Call GetGUID(MyCategory & MySource & "\HOLDING\") End If End If MySource = Dir <-- I am getting the error here after calling GetGUID Loop End Function Private Function GetGUID(MySource As String) As String Dim MyDir3 Dim MyGUID As String MyGUID = Dir(MySource, vbDirectory) Do While MyGUID <> "" If MyGUID <> "." And MyGUID <> ".." Then Debug.Print MyGUID End If MyGUID = Dir Loop End Function




Reply With Quote