tags:

views:

28

answers:

3

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

+1  A: 

http://msdn.microsoft.com/en-us/library/2z9ffy99%28v=VS.85%29.aspx

Will A
http://stackoverflow.com/questions/3233118/vba-exists-function-without-giving-any-error
I__
+1  A: 

These guys have excellent examples of how tto use the filesystem object 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
%> 
Gerald Ferreira
http://stackoverflow.com/questions/3233118/vba-exists-function-without-giving-any-error
I__
+2  A: 

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
Robert Mearns
robert thank you very much
I__