Private Sub Dir1_Change()
    File1.Path = Dir1.Path
End SubPrivate Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
End Sub

解决方案 »

  1.   

    首先感谢 Topc008  老师 !还得请教Topc008  老师或其他老师们,当Drive1控件点到光驱时,执行 Dir1.Path = Drive1.Drive 代码,就会出错,求助弹出提示后终止过程的代码,谢谢!
      

  2.   

    Private Sub Dir1_Change()
        File1.Path = Dir1.Path
    End SubPrivate Sub Drive1_Change()
    '    引用 microsoft scripting runtime
        Dim fso As New FileSystemObject
        If fso.GetDrive(Drive1.Drive).IsReady Then
            Dir1.Path = Drive1.Drive
        Else
            MsgBox Drive1.Drive & "没准备好"
        End If
        Set fso = Nothing
    End Sub
      

  3.   

    谢谢老师!
    挂在 Dim fso As New FileSystemObject 这句上了,
    提示“用户定义类型未定义” ?  继续求救 
      

  4.   

    不是已经告诉你要“引用 microsoft scripting runtime”了吗?