FileSystemObject trouble in VB6 error 429

I have placed the following code in my app...

'---------------------------------------
Private Sub Form_Load()

Dim fs, f

Set fs = CreateObject("Scripting.FileSystemObject")

End Sub
'-----------------------------------------


Simple enough I thought. I get an error 429, ActiveX cannot create
an object' when the 'Set fs = CreateObject... line executes.
I have ensured the the scrrun.dll in included in the Project references
and the the scrrun.dll is registered with regsrv32.exe.

I am kinda stumped where to go. I have searched a ton of previous
messages on various boards about 429 FSO errors but none of the
solutions seem to apply.

Help would be appreciated.

DaveF
eatc7402

Comments

  • : I have placed the following code in my app...
    :
    : '---------------------------------------
    : Private Sub Form_Load()
    :
    : Dim fs, f
    :
    : Set fs = CreateObject("Scripting.FileSystemObject")
    :
    : End Sub
    : '-----------------------------------------
    :
    That will work for VBScript. Working with VB6 we have to use code like that
    [code]
    Dim fs As FileSystemObject

    Set fs = CreateObject("Scripting.FileSystemObject")

    If fs.FolderExists("C:/MyFolder") Then
    'do something
    End if
    [/code]
    or even better
    [code]
    Dim fs As New FileSystemObject

    If fs.FolderExists("C:/MyFolder") Then
    'do something
    End if
    [/code]
  • : : I have placed the following code in my app...
    : :
    : : '---------------------------------------
    : : Private Sub Form_Load()
    : :
    : : Dim fs, f
    : :
    : : Set fs = CreateObject("Scripting.FileSystemObject")
    : :
    : : End Sub
    : : '-----------------------------------------
    : :
    : That will work for VBScript. Working with VB6 we have to use code like that
    : [code]
    : Dim fs As FileSystemObject
    :
    : Set fs = CreateObject("Scripting.FileSystemObject")
    :
    : If fs.FolderExists("C:/MyFolder") Then
    : 'do something
    : End if
    : [/code]
    : or even better
    : [code]
    : Dim fs As New FileSystemObject
    :
    : If fs.FolderExists("C:/MyFolder") Then
    : 'do something
    : End if
    : [/code]
    :


    Yes, it dawned on me also that it was NOT Scripting I was
    interested in. Getting to the FileSystemObject is what I needed.

    Yes the above code works fine in VB6. Thanks.

    DaveF
    eatc7402

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion