Microsoft KB Archive/247979

= PRB: Error 429 Using MSDN File System Object Programming Examples =

Article ID: 247979

Article Last Modified on 8/6/2007

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q247979



SYMPTOMS
You are distributing an application that uses one of the MSDN programming examples for the File System Object (FSO) when you are running an application after installation the following error appears:

Runtime Error '429' : ActiveX Component Can't Create Object



CAUSE
This error occurs because many of the MSDN code examples use late binding to the Microsoft Scripting Runtime (the component that contains the FS0.) Because late binding is used, a reference to the component (Scrrun.dll) is not required. When you use the Setup Wizard or Package and Deployment Wizard to package your application, the Wizards look at the references in the project to see which components need to be included in the package. Because there is no reference for this component, the component is not included, and the end result is an error when you attempt to create an FSO.

This problem is not specific to the FSO or the Scripting Runtime. The error can occur with any component when you use late binding. If you are using late binding, make certain that the component you are late binding to is either included with your application package or is already present on the target computer.



RESOLUTION
The Microsoft Scripting Runtime must be installed from the Microsoft Windows Script components. The Microsoft Windows Script components are installed by a self-extracting EXE. You can redistribute this EXE with your setup package. Alternately, your customers can download and install the appropriate self-extracting EXE at following Microsoft Web site:

http://www.microsoft.com/downloads/details.aspx?FamilyID=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en



STATUS
This behavior is by design.



Steps to Reproduce Behavior
 Verify that the scripting runtime (Scrrun.dll) is present on your computer. Start a new Standard EXE project in Visual Basic. Form1 is created by default.  Add the following code to Form1. (This code is from a MSDN example.) Private Sub Form_Click Set fs = CreateObject("Scripting.FileSystemObject") Set a = fs.CreateTextFile("c:\testfile.txt", True) a.WriteLine ("This is a test.") a.Close End Sub  From the File Menu, save the project then chose Make Project1.exe. To verify that this works, run the EXE and click on the form. You will find a file named Testfile.txt in you root (C:\) directory that contains the text, "This is a test."</li> Start the Package and Deployment Wizard, and build a setup package for Project1.</li> Install the application on a computer that does not have the scripting runtime installed.</li> Run the application, and click on Form1.</li> You should receive Error 429.</li></ol>

<div class="references_section">