×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Error creating object in Class module - 429 ActiveX component can't create object

Error creating object in Class module - 429 ActiveX component can't create object

Error creating object in Class module - 429 ActiveX component can't create object

(OP)
This is weird. This code essentially works if I do not use a Class Module and works with either early or late binding.
In the Class module, I receive the error setting rfFaxServer. The code below is just an excerpt of the key elements. I have a working procedure that sets the fax server object exactly the same way but with all the variables declared within the procedure (scoped to the procedure). Aside from this little scope difference the only thing I see different is that this is a Class module and this is a constructor.

The idea is really simple. Make a class that opens the top level fax server and then iteratively call a sendfax method and possibly implement additional features like resending faxes that failed on the first attempt. This code uses the RightFax API.

CODE

Private rfFaxServer As Object 'New RFCOMAPILib.FaxServer
Private rfFax As Object 'RFCOMAPILib.Fax

Private Sub Class_Initialize()
  
  Set rfFaxServer = CreateObject("RFCOMAPILib.FaxServer") 'Run-time error '429'
                                                          'ActiveX component can't create object
  
      With rfFaxServer
        .ServerName = conFaxServer 'Defined and not included in the excerpt
        .Protocol = 6 'Right Fax constant value cpSecTCPIP
        ' Use for User NT Authentication...
        .AuthorizationUserID = Environ("UserName") 'Perhaps a bit lazy but should fail if environment variable hacked
        .UseNTAuthentication = True
    End With
End Sub 

I don't get it... I have a PDF Class module that has a constructor that starts like the below and works. In fairness, it is a different project / file.

CODE

Private Sub Class_Initialize()

    'Initializations.
    
    Set fso = CreateObject("Scripting.FileSystemObject") 'New FileSystemObject 'Use late binding
    
    Set PDFApp = CreateObject("AcroExch.App")
    Set TargetDocument = CreateObject("AcroExch.PDDoc")
    Set Part2Document = CreateObject("AcroExch.PDDoc") 

I forgot to kitchen sink compiled code issues, something for tomorrow but I sincerely doubt that it is the issue.

Any thoughts, wild guesses or condolences?

If I get desperate I guess I could declare the Fax server outside of a send fax function and pass it as a parameter, so much for my dream of a bigger class and cleanliness of simple object declaration without setup properties. Setup properties ... I could pass my server variable to a Pseudo-constructor procedure that has the properties.

RE: Error creating object in Class module - 429 ActiveX component can't create object

(OP)
I did some more digging and playing...

Paragraph corrected from original version to specify "Early" instead of "Late" binding:
Early binding simply does not work as the Fax Server has to be instantiated with the new keyword and apparently a regular module. I am guessing something can be done with permissions to prevent certain declarations... All grey area to me but the MS help topic mentioned not having permissions to the Type library as an issue in getting that error.

CODE

Public Function rfFaxServer(Optional SetNothing As Boolean = False) As Object
  Static rfFaxServerInternal As New RFCOMAPILib.FaxServer
  
  If SetNothing = True Then
    Set rfFaxServerInternal = Nothing
  Else
    If rfFaxServerInternal Is Nothing Then
      Set rfFaxServerInternal = CreateObject("RFCOMAPILib.FaxServer") 'Run-time error '429'
                                                              'ActiveX component can't create object
      
          With rfFaxServerInternal
            .ServerName = conFaxServer 'Constant set elsewhere
            .Protocol = 6 'Right Fax constrant value cpSecTCPIP
            ' Use for User NT Authentication...
            .AuthorizationUserID = Environ("UserName") 'Perhaps a bit lazy but should fail if a hack
            .UseNTAuthentication = True
        End With
    Else
      
    End If
  End If
  Set rfFaxServer = rfFaxServerInternal
End Function 

RE: Error creating object in Class module - 429 ActiveX component can't create object

(OP)
Interesting, to preserve names, I renamed the function and used it to initialize and destroy the class object. One line of code each. And it can go in the class module... Just not a constructor directly. ponder

If someone could shed some light on permissions or what is going on, I would appreciate it.

RE: Error creating object in Class module - 429 ActiveX component can't create object

Out of curiosity, try running your host application (Excel or Access or ...?) As Administrator.

RE: Error creating object in Class module - 429 ActiveX component can't create object

Hmmm - I'm not following your last post. Could you post the code of the class module where (I think) you say it works?

RE: Error creating object in Class module - 429 ActiveX component can't create object

>Late binding simply does not work
I don't think that is the issue, as Rightfax works in Vbscript, which can only use late binding ...

RE: Error creating object in Class module - 429 ActiveX component can't create object

(OP)
Strongm, I miswrote. EARLY binding simply does not work.

DjangMan, I don't have the ability to run as administrator in this environment and no right fax at home.

Mocking up a version excerpt of the class code below...

CODE

Private rfFaxServer As Object 'New RFCOMAPILib.FaxServer
Private rfFax As Object 'RFCOMAPILib.Fax

Private Sub Class_Initialize()
  
  Set rfFaxServer = rfFaxServerObject

End sub

Public Function rfFaxServerObject(Optional SetNothing As Boolean = False) As Object
  Static rfFaxServerInternal As New RFCOMAPILib.FaxServer
  
  If SetNothing = True Then
    Set rfFaxServerInternal = Nothing
  Else
    If rfFaxServerInternal Is Nothing Then
      Set rfFaxServerInternal = CreateObject("RFCOMAPILib.FaxServer") 'Run-time error '429'
                                                              'ActiveX component can't create object
      
          With rfFaxServerInternal
            .ServerName = conFaxServer 'Constant set elsewhere
            .Protocol = 6 'Right Fax constrant value cpSecTCPIP
            ' Use for User NT Authentication...
            .AuthorizationUserID = Environ("UserName") 'Perhaps a bit lazy but should fail if a hack
            .UseNTAuthentication = True
        End With
    Else
      
    End If
  End If
  Set rfFaxServerObject= rfFaxServerInternal
End Function 

RE: Error creating object in Class module - 429 ActiveX component can't create object

Er - this code example is early binding. Is it an example of what does not work, then?

RE: Error creating object in Class module - 429 ActiveX component can't create object

(OP)
I am all over the place with negatives and confusing myself. Late binding did not work. Early binding did. Even Early binding did not work in the class constructor (Class_Initialize) directly, I had to farm it out to a function.

RE: Error creating object in Class module - 429 ActiveX component can't create object

>Late binding did not work

Ok - so … something else must be going on, since we know that in theory late binding works OK with RightFax (since it works with e.g. VBScript, which only does late binding). First off, might I suggest that use Dependency Walker to see if there are any dependency issues with RFCOMAPILib. If you don't have a copy, then you can find it here

RE: Error creating object in Class module - 429 ActiveX component can't create object

(OP)
Unfortunately, I am not going to be able to load outside software. It works this way and I suspect whatever goofy issue there is with the software, is likely replicated to multiple machines. So I think I will keep with my path of least resistance, it works this way.

It had not occurred to me to try it on another machine because of a potential install issue.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close