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.
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.
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.
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.