References and Microsoft Scripting Runtime library

  • Thread starter Thread starter Tony Seiscons
  • Start date Start date
T

Tony Seiscons

I know that I can create two file scripting objects with

Dim fsObject As Object, tsTextFile As Object

and then assign them with :

Set fsObject = CreateObject("Scripting.FileSystemObject")
Set tsTextFile = fsObject.OpenTextFile("C:\FolderName\TextFileName.txt",
1)

without setting a reference to the Microsoft Scripting Runtime Library.

If I create a reference to the library with Tools-References in the VB IDE I
can use

Dim fsObject as Scripting.FileSystemObject
Dim tsTextFile as Scripting.TextStream

and then

Set fsObject =New FileSystemObject
Set tsTextFile New tsOpenText("C:\FolderName\TextFileName.txt",
ForWriting, True)

I guess that this is early and late binding.

My question is this. I know that the first set of code will run without the
reference to the Microsoft Scripting Runtime Library set via the IDE but
will the second method? The second one is more useful to work with as the
context help becomes available with the reference set but if I give the
program to someone else I don't think it will it still work without the
reference being set. Can I set the reverence in code?

Tony
 
If you give the code to someone to run, why would they need context help?

Most recommend developing with the reference, then convert to late binding
for distibution.
 
Back
Top