CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2008
    Posts
    3

    Question Faxing Data Report in VB6

    Hi every body,

    I'm working on a program in VB6 which generate reports (using Data report).
    I want the program to automatically send the generated report to someone using details (recepient name and fax number) gathered from a text zone.

    FYG, i'm using Microsoft Fax Server.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Faxing Data Report in VB6

    I think you need WinFax or some other program. Or, there's online faxing...

    http://www.interfax.net/en/dev/webse...6_sendfax.html
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jan 2008
    Posts
    3

    Re: Faxing Data Report in VB6

    thx for the reply but my problem is that i can't get the file i want from the DataReport.
    The DataReport can export file only to HTLM or TEXT formats which are not good for me because the report generated by my DataReport contains some images which are not exported neither to the HTML nor TEXT files (and even the organization of items in the exported HTML file is very bad).

    I can print the DataReport to the fax but when i got the fax prompt i can't access it from VB to fill the fields (receipient and fax number).

  4. #4
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    1,901

    Re: Faxing Data Report in VB6

    Note: This advice comes from the pain of experience of trying to create a robust system with Microsoft Fax (you cant)

    As you will find out rapidly, Microsoft Fax Server is NOT the most friendly Faxing Software to use. Take dglienna's advice and go straight Interfax.net - do not stop to even think about Winfax Pro - abandon MS Fax - and enjoy the simplicity of faxing on line

    In simple terms, it means that if you can send an email from your computer (any computer in the network), then you are also able to send a fax from that workstation

    You actually create what you want to fax in a Word Doc, Excel File, PDF File, or any combination, and you Email it to Interfax which in turn, creates the relevant TIFF files and faxes them to the recipient fax machine

    You are then able to view the log of files faxed via the internet

    Fax charges are per page and are most times cheaper than Faxing using your phone line

    No doubt you will still attempt to use MS Fax regardless of this precious advice, and will find that you will be rewarded with frustration and heartache and will get answers on the subject NOWHERE - not even from Microsoft.

  5. #5
    Join Date
    Nov 2004
    Location
    Lincoln, NE
    Posts
    516

    Re: Faxing Data Report in VB6

    Quote Originally Posted by Naruto_kun
    thx for the reply but my problem is that i can't get the file i want from the DataReport.
    The DataReport can export file only to HTLM or TEXT formats which are not good for me because the report generated by my DataReport contains some images which are not exported neither to the HTML nor TEXT files (and even the organization of items in the exported HTML file is very bad).

    I can print the DataReport to the fax but when i got the fax prompt i can't access it from VB to fill the fields (receipient and fax number).
    I would try to find the window that the fax software opens and automate it. While it may not be the ideal solution, as others in the thread have pointed out, other solutions can be extremely difficult (don't even ask me about my experiences with RightFax). Do some searches on automating 3rd party forms and you'll find a wealth of examples.
    Quote Originally Posted by George1111
    As you will find out rapidly, Microsoft Fax Server is NOT the most friendly Faxing Software to use. Take dglienna's advice and go straight Interfax.net - do not stop to even think about Winfax Pro - abandon MS Fax - and enjoy the simplicity of faxing on line
    Just a quick note on this -- the company I work for would NEVER let me do this. We're so tangled in consumer privacy regulations that sending a document to a third party in order to fax it is not even a consideration. Ditto with any kind of internal document.

  6. #6
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Faxing Data Report in VB6

    Well, I haven't used WinFax for a few years, but noticed they're still around.

    I don't like the DataReport, but you may be able to use a PDF printer to get the document to fax. I remember the old apps that used to save .TIFF files.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  7. #7
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    1,901

    Re: Faxing Data Report in VB6

    Originally Posted by Comintern
    Just a quick note on this -- the company I work for would NEVER let me do this. We're so tangled in consumer privacy regulations that sending a document to a third party in order to fax it is not even a consideration. Ditto with any kind of internal document.
    Isn't that how Email works ? You send a document to your ISP who in turn pass it on to the email address.

    Incoming Emails normally sit in an ISP inbox until you download them.

    Do you believe that if someone at the ISP really wants to read your mail they can't ?

    If you are your own ISP then my comments are probably irrelevant.

  8. #8
    Join Date
    Jan 2008
    Posts
    3

    Re: Faxing Data Report in VB6

    Thanks for yours replies,

    <quote> George1111
    If you are your own ISP then my comments are probably irrelevant.

    Yes it is my case, and i can't use a third party fax. Then i will ask the users to manually send their faxs until i find a solution.

  9. #9
    Join Date
    Nov 2004
    Location
    Lincoln, NE
    Posts
    516

    Re: Faxing Data Report in VB6

    Quote Originally Posted by George1111
    Isn't that how Email works ? You send a document to your ISP who in turn pass it on to the email address.

    Incoming Emails normally sit in an ISP inbox until you download them.

    Do you believe that if someone at the ISP really wants to read your mail they can't ?

    If you are your own ISP then my comments are probably irrelevant.
    We don't have our own ISP, but we are required to use an encrypted secure mail system for a bulk of our external communications. Generally if we are required to fax something as opposed to imaging it and sending it via email, it is subject to those same security restrictions. Isn't the corporate environment fun?

  10. #10
    Join Date
    Aug 2003
    Location
    Sydney, Australia
    Posts
    1,901

    Re: Faxing Data Report in VB6

    Try this (Make sure Faxing Service is turned on in the Control File)
    You will know it is if you can see it in the printers list

    You just may be in luck - I have discovered this code which looks like it may just do the job for you !


    Code:
    Sending a Fax 
    The following Microsoft Visual Basic code example sends a fax. Note that if you were to convert this Visual Basic example to Visual Basic Scripting Edition (VBScript), you would have to use an enumeration constant instead of the value fptHigh. For more information, see Using Enumerations in Scripts.
    
    
    Private Sub Form_Load()
    Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
    Dim objFaxServer As New FAXCOMEXLib.FaxServer
    Dim objSender As FaxSender
    Dim JobID As Variant
    
    'Error handling
    On Error GoTo Error_Handler
    
    'Connect to the fax server
    objFaxServer.Connect ""
    
    'Set the fax body
    objFaxDocument.Body = "c:\Docs\Body.txt"
    
    'Name the document
    objFaxDocument.DocumentName = "My First Fax"
    
    'Set the fax priority
    objFaxDocument.Priority = fptHIGH
    
    'Add the recipient with the fax number 12225550100
    objFaxDocument.Recipients.Add "12225550100", "Bud"
    
    'Choose to attach the fax to the fax receipt
    objFaxDocument.AttachFaxToReceipt = True
    
    'Set the cover page type and the path to the cover page
    objFaxDocument.CoverPageType = fcptSERVER
    objFaxDocument.CoverPage = "generic"
    
    'Provide the cover page note
    objFaxDocument.Note = "Here is the info you requested"
    
    'Provide the address for the fax receipt
    objFaxDocument.ReceiptAddress = "[email protected]"
    
    'Set the receipt type to email
    objFaxDocument.ReceiptType = frtMAIL
    
    'Specify that the fax is to be sent at a particular time
    objFaxDocument.ScheduleType = fstSPECIFIC_TIME
    'CDate converts the time to the Date data type
    objFaxDocument.ScheduleTime = CDate("4:35:47 PM")
    
    objFaxDocument.Subject = "Today's fax"
    
    'Set the sender properties.
    objFaxDocument.Sender.Title = "Mr."
    objFaxDocument.Sender.Name = "Bob"
    objFaxDocument.Sender.City = "Cleveland Heights"
    objFaxDocument.Sender.State = "Ohio"
    objFaxDocument.Sender.Company = "Microsoft"
    objFaxDocument.Sender.Country = "USA"
    objFaxDocument.Sender.Email = "[email protected]"
    objFaxDocument.Sender.FaxNumber = "12165555554"
    objFaxDocument.Sender.HomePhone = "12165555555"
    objFaxDocument.Sender.OfficeLocation = "Downtown"
    objFaxDocument.Sender.OfficePhone = "12165555553"
    objFaxDocument.Sender.StreetAddress = "123 Main Street"
    objFaxDocument.Sender.TSID = "Office fax machine"
    objFaxDocument.Sender.ZipCode = "44118"
    objFaxDocument.Sender.BillingCode = "23A54"
    objFaxDocument.Sender.Department = "Accts Payable"
    
    'Save sender information as default
    objFaxDocument.Sender.SaveDefaultSender
    
    'Submit the document to the connected fax server
    'and get back the job ID.
    
    JobID = objFaxDocument.ConnectedSubmit(objFaxServer)
    
    MsgBox "The Job ID is :" & JobID(0)
    
    objFaxServer.Disconnect
    
    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


    NOW HERE'S ANOTHER VARIATION FOR BROADCASTING FAXES TO A LIST


    Code:
    Broadcasting a Fax 
    The code for broadcasting a fax is similar to the code for sending a fax. This code example uses the Submit rather than the ConnectedSubmit method, and therefore does not create a FaxServer object. The FaxDocument object serves as the root object. Also, the code differs in the number of recipients and the number of job IDs returned.
    
    
    Private Sub Form_Load()
    Dim objFaxDocument As New FAXCOMEXLib.FaxDocument
    Dim collFaxRecipients As FaxRecipients
    Dim JobId As Variant
    
    'Error handling
    On Error GoTo Error_Handler
    
    'Set the fax body
    objFaxDocument.Body = "c:\Docs\Body.txt"
    
    'Name the document
    objFaxDocument.DocumentName = "My First Fax"
    
    'Get the recipients collection
    Set collFaxRecipients = objFaxDocument.Recipients
    
    'Add the recipients
    With collFaxRecipients
        .Add "12225550105", "H"
        .Add "12225550104", "N"
        .Add "12225550103", "G"
    End With
    
    'Display number of recipients
    MsgBox "Number of recipients: " & collFaxRecipients.Count
    
    'Display recipient information
    Dim i As Long
    For i = 1 To collFaxRecipients.Count
        MsgBox "Recipient number " & i & ": " & collFaxRecipients.Item(i).Name & ", " & collFaxRecipients.Item(i).FaxNumber
    Next
    
    'Load the default sender
    objFaxDocument.Sender.LoadDefaultSender
    
    'Group the broadcast receipts
    objFaxDocument.GroupBroadcastReceipts = True
    
    'Connect to the fax server, submit the document, and get back the
    'job ID array. "" indicates the local server.
    JobId = objFaxDocument.Submit("")
    
    'UBound finds the size of the array
    For n = 0 To UBound(JobId)
        MsgBox "The Job ID is " & JobId(n)
    Next
    
    'Remove the recipients from the collection. If you don't take this step, 
    'and run this code again without closing the program, the recipients 
    'collection will retain the recipients and keep adding more recipients.
    'The count and item numbering will change as you remove the items, so 
    'just remove item (1) Count times
    Dim lCount As Long
    lCount = collFaxRecipients.Count
    For i = 1 To lCount
        collFaxRecipients.Remove (1)
    Next
    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

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured