如何在VBA中使用FileSystemObject? [英] How do I use FileSystemObject in VBA?
本文介绍了如何在VBA中使用FileSystemObject?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Dim fso As New FileSystemObject
Dim fld As Folder
Dim ts As TextStream
我收到错误,因为它无法识别这些对象。
解决方案
在Excel中,您需要设置对VB脚本运行时库的引用。
相关文件通常位于 \Windows\System32\scrrun.dll
- 要引用此文件,请加载
Visual Basic编辑器( ALT + F11 ) - 从下拉菜单中选择工具>参考
- 将显示可用参考的列表框。
- 勾选' code> Microsoft Scripting Runtime '
-
scrrun.dll的全名和路径
文件将显示在列表框下方 - 点击确定按钮。
Is there something that I need to reference? How do I use this:
Dim fso As New FileSystemObject
Dim fld As Folder
Dim ts As TextStream
I am getting an error because it does not recognize these objects.
解决方案
Within Excel you need to set a reference to the VB script run-time library.
The relevant file is usually located at \Windows\System32\scrrun.dll
- To reference this file, load the Visual Basic Editor (ALT+F11)
- Select Tools > References from the drop-down menu
- A listbox of available references will be displayed
- Tick the check-box next to '
Microsoft Scripting Runtime
' - The full name and path of the
scrrun.dll
file will be displayed below the listbox - Click on the OK button.
这篇关于如何在VBA中使用FileSystemObject?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文