References and Microsoft Scripting Runtime library

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
 
T

Tom Ogilvy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top