Type Mismatch ? (1 Viewer)

liamfitz

Registered User.
Local time
Today, 15:01
Joined
May 17, 2012
Messages
240
The following command line, should return the sub-folders in the folder - path ( string ) 'folderstr'. The syntax and declarations for the variables seem fine. No errors, but I get 'Type Mismatch' on this line ...
Code:
Set flds = fso.GetFolder(folderstr).SubFolders

this should load the folder names into this variable, 'flds'. It is declared earlier as ...
Code:
Dim flds As Folders
Any ideas ? Thanks.
:confused:
 

liamfitz

Registered User.
Local time
Today, 15:01
Joined
May 17, 2012
Messages
240
Here is the full code. You should be able to follow the logic from this.

Code:
Dim fso As Scripting.FileSystemObject
        Set fso = CreateObject("Scripting.FileSystemObject")
        Dim flds As Folders
        Dim strText As String
        Dim i, pos As Integer
        Set flds = fso.GetFolder(folderstr).SubFolders
        i = 0
        For Each f In flds
            If f.Files.Count > 0 Then ....
etc.
 

pr2-eugin

Super Moderator
Local time
Today, 15:01
Joined
Nov 30, 2011
Messages
8,494
I ran the code with no trouble at all.. Have you enabled the Microsoft Runtime Scripting reference? Are you passing the correct path?
 

liamfitz

Registered User.
Local time
Today, 15:01
Joined
May 17, 2012
Messages
240
I will check now ( I believe I have ). Thanks.
 

liamfitz

Registered User.
Local time
Today, 15:01
Joined
May 17, 2012
Messages
240
It's now working - Thanks ( it seemed it was only failing on a public computer, although I did check that I referenced the correct dll - which I had ?? ) Different version.
 

Users who are viewing this thread

Top Bottom