| 
    
     |  | ▼akichn さん: 
 とりあえず TestBox1 に c:\Test といったフォルダフルパス文字列をいれ、
 CommandButton1 で処理するコード案です。
 もし、別途、Changeイベント連鎖を回避する手立てをしておられるなら、
 TextBox1_Change のままでもよろしいかと思いますが、これについては
 具体的に、どのように回避しておられるのか見えないのでコメントできません。
 
 Private Sub CommandButton1_Click()
 Dim myPath As String
 Dim ok As Boolean
 Dim fname As String
 Dim w As Variant
 
 ListBox1.Clear
 myPath = TextBox1.Value
 
 If Len(Dir(myPath, vbDirectory)) > 0 Then
 If (GetAttr(myPath) And vbDirectory) = vbDirectory Then ok = True
 End If
 
 If Not ok Then
 MsgBox "指定フォルダは存在しません"
 Exit Sub
 End If
 
 fname = Dir(myPath & "\*.*")
 
 Do While Len(fname) > 0
 w = Split(fname, ".")
 Select Case LCase(w(UBound(w)))
 Case "jpg", "bmp", "tif", "gif"
 ListBox1.AddItem fname
 End Select
 fname = Dir()
 Loop
 
 End Sub
 
 |  |