Results 1 to 9 of 9
  1. #1
    New Lounger
    Join Date
    Sep 2002
    Location
    Frisco, Texas, USA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ActiveX error when reading test file (Excel 2000)

    I was running a macro using Excel 2000 on WINNT SP6a to read in and parse a text file, I then upgraded to WIN 2000 pro now the macro gets the following error:

    Run-time error '429'
    ActiveX component can't create object

    The section of code is as follows:

    Set fs = CreateObject("Scripting.FileSystemObject") <----This is the line that gets the error
    Set a = fs.OpenTextfile(sFilename, ForReading, False)

    Has anyone else experienced this?

    Thanks for any help you can give.

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ActiveX error when reading test file (Excel 2000)

    The Scripting.FileSystemObject class is served from Microsoft Scripting Runtime, which is physically manifested in the form of a dll called scrrun.dll. Check for the existence of this dll in your windows directory (probably C:WINNT) under a subfolder called 'system32'. If it is there, then make sure it is registered, by doing the following:-

    1.Go to Start Menu->Run
    2. Type
    <pre>regsvr32 c:winntsystem32scrrun.dll</pre>

    and hit enter

    Now try your code again.

    If you don't have this dll at all, or if the above steps don't resolve the problem, then I'd suggest reinstalling Internet Explorer, as scrrun.dll is included in the IE install.

  3. #3
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ActiveX error when reading test file (Excel 2000)

    Having done that, you may also have to set a reference to it in your code.

    In your VB editor environment- Tools, References, and check the box next to Microsoft Scripting Runtime.
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  4. #4
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ActiveX error when reading test file (Excel 2000)

    That's only if you want to use early binding and declare your variable as a FileSystemObject.

    In the code example given, the variable must be declared as Object or Variant otherwise the declaration would fail.

    If CreateObject() is used then this in itself does not require referencing of the library which serves the desired class, since CreateObject uses the registry to look up the CLSID and then the file which serves that class.

    So in this example, referencing the library should not be required. If it is a legacy app. I would not add a reference either, since the app. may even be coded to run without it with this particular untrapped error being a bug, and a reference would add a dependency on MS Scripting Runtime.

    This of course may all be academic if it's a small app run by a small number of users.

  5. #5
    New Lounger
    Join Date
    Sep 2002
    Location
    Frisco, Texas, USA
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ActiveX error when reading test file (Excel 2000)

    Thankyou all for your help and quick response. It seems my problem was the registering of the scripting dll. All my code is working again.

    Thanks.

  6. #6
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Adelaide, South Australia, Australia
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ActiveX error when reading test file (Excel 2000)

    Brilliant Geoff, that solved my unanswered query <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=xl&Number=78244&page=3&view =expanded&sb=5&o=0&fpart>Weird macro behaviour</A>

  7. #7
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ActiveX error when reading test file (Excel 2000)

    Interesting, I would not have expected it.

    Didi you add the reference to th MS Scripting Object, or something else?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  8. #8
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Adelaide, South Australia, Australia
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ActiveX error when reading test file (Excel 2000)

    Geoff,
    I just brought up the VBA editor, Tools/References, then checked Microsoft Scripting Runtime. What does that do?

  9. #9
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Flims, Switzerland
    Posts
    271
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ActiveX error when reading test file (Excel 2000)

    That adds reference to the library. It means you can use global functions from that library and declare variables using that library's classes, enums and types.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •