2017-05-17 9 views

答えて

1

次のコードは、必要に応じて行う必要があります。

Option Explicit 
' create a FileSystemObject 
Dim oFso : Set oFso = CreateObject("Scripting.FileSystemObject") 
' Set a reference to the folder which contains the folders you want to look through 
Dim oFolder : Set oFolder = oFso.GetFolder("PathToFolderInHere") 
Dim oSubFolder, myVar 
' loop through each subfolder 
For Each oSubFolder in oFolder.SubFolders 
    ' If the oSubFolder contains the word complete then set myVar and exit the loop 
    If InStr(1, oSubFolder.Name, "complete", vbTextCompare) > 0 Then 
     myVar = oSubFolder.Name 
     Exit For 
    End If 
Next 

' do whatever with myVar (the folder name you wanted in the variable). 
関連する問題