Object Required

Results 1 to 3 of 3

Thread: Object Required

  1. #1
    Join Date
    Dec 1969

    Default Object Required

    Hello all. I am having trouble with the TextStream object in a COM object. I must be missing something totally obvious. Every time I call the setPath method from ASP (VB COM code below), I get an Object Required error. For some reason it won&#039t let me create the TextStream object. There is no error on the creation of the object. This is driving me NUTS! Any help is appreciated. Thanks -- Greg<BR><BR>Private Sub Class_Initialize()<BR> Dim fso As New FileSystemObject<BR> Dim txtStream As TextStream<BR>End Sub<BR><BR>Public Sub setPath(path As Variant)<BR> Set txtStream = fso.CreateTextFile(path, True)<BR>End Sub<BR><BR>Public Sub writeHTML(str As Variant)<BR> txtStream.Write (str)<BR>End Sub<BR><BR>Public Sub closeMe()<BR> txtStream.Close<BR>End Sub

  2. #2
    KPW Guest

    Default RE: Object Required

    I don&#039t see anywhere where you have<BR><BR>Set fso = New FileSystemObject<BR><BR>You have declared it, but not set it.<BR><BR>HTH

  3. #3
    David Mills Guest

    Default RE: Object Required

    You are declaring the variable fso as a local variable in the Initialization sub-routine. It is not accessible to the other functions this way. You need to declare it as a global private. Outside of any subroutine use the following syntax ....<BR><BR>Private fso As New FileSystemObject<BR><BR>... this will allow you to access the object from any subroutine or function the class.

Posting Permissions

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