FileObjectSystem Malfuction

On my last program the FSO doesn't work. it give me the "run-time error 91 object variable or with block variable not set", but if i run other program that have the same code "fso.createfolder" (fso as filesystemobject) it work's greats.. some one can help me to understand



Answer this question

FileObjectSystem Malfuction

  • Fire Fox gug

    If you are having problems with code it is usually best to provide the code that is giving the problem. Paste the full exception and state at which line it is occurring at. This way other people don't have to try to be psychic and guess what part of your code is not working and you can get your answer quicker. Hope this helps.

  • Mike11

    Hello
    You should post this to one of the VB news groups. The main goal of this forum is to answer questions around code performance & security using the advanced development tools in VSTS 2005 including static and dynamic analysis, code profiling, and unit testing.

    Thanks
    Brian [MSFT]
    Microsoft Developer Support
    This posting is provided "AS IS" with no warranties, and confers no rights.


  • Sinatra

    public fso as filesystemobject (on module code)

    (on spashscreen code)
    Private Sub Form_Load()
    lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
    lblProductName.Caption = "Relatorio de Avarias"
    If fso.FolderExists(".\AvariaRelat") Then
    fso.GetFolder (".\AvariaRelat")
    Else
    fso.CreateFolder (".\AvariaRelat")
    End If

    End Sub
    #That code give me an error.. "run time 91 object variable or with block not set"......

    But i have this code in another program
    (on module code)
    public fso as filesystemobject

    (on splashscreen code)
    Private Sub Form_Load()
    lblVersion.Caption = "Version " & App.Major & "." & App.Minor & "." & App.Revision
    Label1.Visible = False
    Progress.Visible = False
    If fso.FolderExists(".\data") Then
    fso.GetFolder (".\data")
    Else
    fso.CreateFolder (".\data")
    End If
    If fso.FolderExists(".\data\users") Then
    fso.GetFolder (".\data\users")
    Else
    fso.CreateFolder (".\data\users")
    End If
    If Not fso.FileExists(".\data\Materias.mdb") Then
    a = MsgBox("A base de dados esta danificada ou inexistente", vbOKOnly + vbCritical, "Verificacao")
    Else
    Main
    End If
    End Sub

    #and it works great.... someone help me to understand


  • FileObjectSystem Malfuction