Home All Groups Group Topic Archive Search About
Author
10 Mar 2006 8:11 PM
Rob T
Hi.  I'm trying to write a small faxing module.   Below are 2 subs that
basically do the same thing.  They both work fine on my XP machine.  When
trying to get it to run on a 2003 server I get the following errors:

   "Error number: 80041b64, the fax server API version does not support the
requested operation" - from sub btnFax_Click at the objFaxServer.Connect("")
command

OR

  "An unhandled exception of type
'system.runtime.interopServices.COMException' occurred in
microsoft.visualbasic.dll   The handle is invald" - from sub Button1_Click
on the FD.send() command

I lifted this code from MSDN so I figured it would have worked!?!  Any help
on getting this to work would be great!  Thanks.

---------------------------------
Imports FAXCOMEXLib


  Private Sub btnFax_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnFax.Click

    Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
    Dim objFaxServer As New FAXCOMEXLib.FaxServer
    Dim JobID As Object

    'Error handling
    On Error GoTo Error_Handler

    objFaxServer.Connect("")
    objFaxDocument.Body = "c:\temp\fax.txt"
    objFaxDocument.DocumentName = "My First Fax"
    objFaxDocument.Priority = FAX_PRIORITY_TYPE_ENUM.fptHIGH
    objFaxDocument.Recipients.Add("1-508-429-7433", "Bud")
    objFaxDocument.Note = "Here is the info you requested"
    objFaxDocument.Subject = "Today's fax"
    JobID = objFaxDocument.ConnectedSubmit(objFaxServer)

    MsgBox("The Job ID is :" & JobID(0))
    Exit Sub

Error_Handler:
    'Implement error handling at the end of your subroutine. This
implementation is for demonstration purposes
    MsgBox("Error number: " & Hex(Err.Number) & ", " & Err.Description)

  End Sub


  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

    Dim FS As Object
    FS = CreateObject("FaxServer.FaxServer")
    Dim ServerName As String
    ServerName = ""

    FS.Connect(ServerName)
    Dim FD As Object
    FD = FS.CreateDocument("c:\temp\fax1.txt")
    FD.FaxNumber = "1-508-429-7433"
    FD.filename = ("c:\temp\fax.txt")
    Dim JobID As Long
    JobID = FD.send()
    FS.disconnect()

    MsgBox("Job ID:" & JobID)

  End Sub
End Class

AddThis Social Bookmark Button