mr_unreliable
Tue Aug 15 12:29:35 CDT 2006
This (vb/vba) code was found was found here:
http://www.vbusers.com/code/codeget.asp?ThreadID=436&PostID=1&NumReplies=0
It is vb code, but looks like it could very easily
be converted to script.
More importantly, if you use this approach you can send faxes
without resorting to sendkeys...
--- <snip> ---
The following code demostrates how to send a fax using Microsoft Outlook.
'Purpose : Sends a fax using Outlook and Microsoft Fax
'Inputs : sFaxNumber The fax number to send the fax to.
' sSubject The fax subject.
' sBody The fax body.
' [sFileName] The file to fax.
'Outputs : Returns an empty string on success, else returns an
error description
'Author : Andrew Baker
'Date : 09/03/2001 14:32
'Notes : Will return a "System Adminstrator" undeliverable
' : message if you do not have Microsoft Fax installed.
'Revisions :
Function OutlookSendFax(sFaxNumber As String, sSubject As String, sBody
As String, Optional sFileName As String) As String
Dim oOutlook As Object 'Outlook.Application
Dim oFax As Object 'Outlook.MailItem
On Error GoTo ErrFailed
Set oOutlook = CreateObject("Outlook.Application")
Set oFax = oOutlook.CreateItem(0) 'olMailItem
With oFax
.To = "[Fax:" & sFaxNumber & "]"
.Subject = sSubject
.Body = sBody
If Len(sFileName) Then
If Len(Dir$(sFileName)) Then
'Add attachment
.Attachments.Add sFileName
End If
End If
.Send
End With
Set oFax = Nothing
Set oOutlook = Nothing
OutlookSendFax = "" 'Return success
Exit Function
ErrFailed:
'Failed, return error description
OutlookSendFax = "Error in OutlookSendFax: " & Err.Description
End Function
'Demonstration routine
Sub Test()
OutlookSendFax "020 7773 1994", "TEST SUBJECT", "TEST BODY",
"c:\myfile.doc"
End Sub
--- </snip> ---
cheers, jw