下面的例子代码显示C:\所有文件,供你参考:
Option ExplicitSub ygb() Dim f, i i = 1 f = Dir("c:\") While f <> "" Cells(i, "A") = f i = i + 1 f = Dir WendEnd Sub