Solved

Faxing a Word Document

Posted on 2003-11-24
5
280 Views
Last Modified: 2010-04-17
Hi experts,
     How can I FAX a Word document? If anyone provide some code, it will be very helpful.
     
     I have the fax number and the word document, faxing should be done in silent mode, becoz user may work in that machine.

Rosh :)
0
Comment
Question by:Roshan Davis
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
SNilsson earned 500 total points
ID: 9816350
If you have outlook installed you can do it in word VBA like this:

Function SendOutlookFax(strFaxNumber As String, strSubject As String, strBody As String, Optional strFileName As String) As String
    Dim objOutlook As Object
    Dim objFax As Object
     
    On Error GoTo ErrCheck

    Set objOutlook = CreateObject("Outlook.Application")
    Set objFax = objOutlook.CreateItem(0)

    With objFax
        .To = "[Fax:" & strFaxNumber & "]"
        .Subject = strSubject
        .Body = strBody
        If Len(strFileName) Then
            If Len(Dir$(strFileName)) Then
                .Attachments.Add strFileName
            End If
        End If

        .Send

    End With
     
    Set objFax = Nothing
    Set objOutlook = Nothing
     
    SendOutlookFax = "" 'Return success
    Exit Function

ErrCheck:
    'Failed, return error description
    SendOutlookFax = "Error in SendOutlookFax: " & Err.Description
End Function


And you call the routine like this:
Sub Test()
    SendOutlookFax "0208 456 7890", "TEST SUBJECT", "TEST BODY", "testfile.txt"
    'This is NOT a valid number as far as I am aware!!!!
End Sub
0
 
LVL 23

Author Comment

by:Roshan Davis
ID: 9816608
Thankx for your comment, is there any other methods without outlook.
And also can send .DOC format
Rosh :)
0
 
LVL 23

Author Comment

by:Roshan Davis
ID: 9822524
Hi SNilsson,

If I specify a .DOC file in that function "SendOutlookFax", will that work without Showing the Word document....?
My problem is, the present code is showing the Word Document while sending... :(

Rosh :)
0
 
LVL 23

Author Comment

by:Roshan Davis
ID: 9822635
Hi SNilsson,

I checked your code, sounds interesting.... Can you tell something about its dependency..

Rosh :)
0
 
LVL 8

Expert Comment

by:SNilsson
ID: 9822802
Hi Rosh,

I have not actually used the code above, found it in a dusty 'good to have' folder.
As for dependency what I can see it's only Outlook.Application (you can change that to early binding of course).

I belive that the word document must be opened to be faxed, but you could use the visible setting on the application to hide it, or just minimize.

GL
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

This is an explanation of a simple data model to help parse a JSON feed
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now