PRB: Error 429 Using MSDN File System Object Programming Examples

ID: Q247979


The information in this article applies to:
  • Microsoft Visual Basic Professional and Enterprise Editions for Windows, versions 5.0, 6.0


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

Add a reference to SCRRUN.dll in your project and rebuild the setup package. The scripting runtime is listed in the References dialog box as "Microsoft Scripting Runtime."

- OR -

Rerun the PDW or Setup Wizard and manually include SCRRUN.dll.


STATUS

This behavior is by design.


MORE INFORMATION

Steps to Reproduce Behavior

  1. Verify that the scripting runtime (Scrrun.dll) is present on your computer.


  2. Start a new Standard EXE project in Visual Basic. Form1 is created by default.


  3. Add the following code to Form1. (This code is from a MSDN example.)


  4. 
    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 
  5. From the File Menu, save the project then chose Make Project1.exe.


  6. 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."


  7. Start the Package and Deployment Wizard, and build a setup package for Project1.


  8. Install the application on a computer that does not have the scripting runtime installed.


  9. Run the application, and click on Form1.


  10. You should receive Error 429.


Additional query words:

Keywords : kbsetup kbwizard kbActiveX kbAppSetup kbDeployment kbVBp kbVBp500 kbVBp600 kbGrpVB kbDSupport
Version : WINDOWS:5.0,6.0
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: December 17, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.