Solved

Faxing a Word Document

Posted on 2003-11-24
5
283 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

821 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