Private Sub SendFax()

Dim whfc As Object
Dim OLE_Return As Long
Dim faxnum As String
Dim SpoolFile As String
Dim Titel As String
Dim WhfcPrinter As String
Dim Box_Return As Integer

SpoolFile = "c:\test.ps"
Titel = "Whfc OLE Makro ( Version 0.01alpha )"
faxnum = "112233"

WhfcPrinter = "Hylafax Faxprinter Whfc"

ActivePrinter = WhfcPrinter$

Application.PrintOut FileName:="", Range:=wdPrintCurrentPage, _
    Item:=wdPrintDocumentContent, Copies:=1, Pages:="", _
    PageType:=wdPrintAllPages, Collate:=True, Background:=True, _
    PrintToFile:=True, OutputFileName:=SpoolFile, Append:=False

  Set whfc = CreateObject("WHFC.OleSrv")
  OLE_Return = whfc.SendFax(SpoolFile, faxnum, True)
  If OLE_Return <= 0 Then
    Box_Return = MsgBox("Error sending file", 16, Titel)
  Else
    Box_Return = MsgBox(OLE_Return, 0, Titel)
  End If
  Set whfc = Nothing

End Sub
