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.
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
Microsoft Scripting Runtime
'scrrun.dll
file will be displayed below the listboxThis can also be done directly in the code if access to the VBA object model has been enabled.
Access can be enabled by ticking the check-box
Trust access to the VBA project object model
found at File > Options > Trust Center > Trust Center Settings > Macro SettingsTo add a reference:
To remove a reference:
After importing the scripting runtime as described above you have to make some slighty modification to get it working in Excel 2010 (my version). Into the following code I've also add the code used to the user to pick a file.
Hope it help!
Best regards
Fabio
In excel 2013 the object creation string is:
instead of the code in the answer above:
These guys have excellent examples of how to use the filesystem object http://www.w3schools.com/asp/asp_ref_filesystem.asp
After adding the reference, I had to use