954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Adding Micorsoft Scripting Runtime dll

Post Thread: Searching Database file if existing or not.

How to Add the Microsoft scripting runtime dll in my Project reference menu. I saw Microsoft Script in the components. Is this the file?

Anybody can help me or give me step by step procedure to add this Microsoft Scripting runtime dll in my project.

Thanks

locsin
Light Poster
47 posts since Aug 2007
Reputation Points: 10
Solved Threads: 0
 

scrrun.dll

That's the exact name of the dynamic link library (dll).

In that library of functions, the file system object can be referenced and used.

To add a reference to your project, simply click on the the Projects menu, click on the References Menu, and a form should show up listing the different libraries that are registered to be used with Visual Basic.

They are in alphabetical order. Look for Microsoft Scripting Runtime and check it's box, if it's not checked already. The Microsoft Script Control is a component used for writing scripts. It does not include the File System Object.

In the declarations section of your form you should declare your own File System Object. Declare an object variable

Option Explicit
dim MyFS0 as FileSystemObject
Dim strFileName as String

And then you should instantiate the object or make an instance of the object using the Set statement

Private Sub Form_Load()
  Set MyFSO = New FileSystemObject
  ' You can now use it.
  if MyFSO.FileExists(strFileName) then
    '  Code if it exists 
  else
    ' Code if it doesn't exist
  endif


'  Be careful to reclaim your variable space in memory after done using the object
Set MyFSO = nothing
End Sub

More in depth information should be gleaned from the MSDN Library:What Can You Do With Visual Basic: Processing Drives, Folders, and Files

hkdani
Posting Pro in Training
435 posts since Nov 2007
Reputation Points: 49
Solved Threads: 47
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You