有什麼我需要參考?我該如何使用它:如何在VBA中使用FileSystemObject?
Dim fso As New FileSystemObject
Dim fld As Folder
Dim ts As TextStream
我得到一個錯誤,因爲它無法識別這些對象。
有什麼我需要參考?我該如何使用它:如何在VBA中使用FileSystemObject?
Dim fso As New FileSystemObject
Dim fld As Folder
Dim ts As TextStream
我得到一個錯誤,因爲它無法識別這些對象。
在Excel中,你需要設置到VB腳本運行時庫的引用很好的例子。 相關文件通常位於\Windows\System32\scrrun.dll
Microsoft Scripting Runtime
'旁邊的複選框scrrun.dll
文件的全名和路徑將顯示在列表框這些人對如何使用文件系統對象http://www.w3schools.com/asp/asp_ref_filesystem.asp
<%
dim fs,fname
set fs=Server.CreateObject("Scripting.FileSystemObject")
set fname=fs.CreateTextFile("c:\test.txt",true)
fname.WriteLine("Hello World!")
fname.Close
set fname=nothing
set fs=nothing
%>
此代碼片段演示在ASP/IIS中使用FSO不是excel – Spangen 2017-12-07 08:34:47
在Excel 2013創建對象字符串是:
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
代替在上面的應答的代碼:
Dim fs,fname
Set fs=Server.CreateObject("Scripting.FileSystemObject")
添加引用後,我不得不使用
Dim fso As New Scripting.FileSystemObject
羅伯特非常感謝你 – 2010-07-13 15:30:00
你在Mac上做什麼? – 2013-02-24 13:50:51
沒有辦法通過命令行來做到這一點,就像在包含庫或其他東西一樣? – LuizAngioletti 2015-08-06 22:03:43