?
Solved

Faxing a Word Document

Posted on 2003-11-24
5
Medium Priority
?
286 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
SNilsson earned 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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…
Introduction to Processes
Suggested Courses

770 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