Solved

Faxing a Word Document

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
countHi challenge 25 98
array6 challenfge 6 81
Device same like our heart 12 75
Filename to be appended with DateTimeof Download 3 46
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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 …

910 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

24 Experts available now in Live!

Get 1:1 Help Now