Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

vbscript include function (See related posts)

This is a vbscript include function, useful for reusing files in a file library. Honestly, I don't remember where I found this, so if you know, post the attribution in a comment, please.
' VBScript "Include" routine
Sub Include(sInstFile)
	On Error Resume Next

	Dim oFSO, f, s

	Set oFSO = CreateObject("Scripting.FileSystemObject")
	If oFSO.FileExists(sInstFile) Then
		Set f = oFSO.OpenTextFile(sInstFile)
		s = f.ReadAll
		f.Close
		ExecuteGlobal s
	End If

	Set oFSO = Nothing
	Set f = Nothing
End Sub

Comments on this post

PauloRamos posts on Apr 06, 2007 at 05:12
Maybe the ExecuteGlobal statement page at http://msdn2.microsoft.com/en-us/library/342311f1.aspx is the best way to really understand how this works and what we can do with it.

It rocks!

You need to create an account or log in to post comments to this site.


Click here to browse all 4858 code snippets

Related Posts