Fax Software

Community Forums

This topic contains 2 replies, has 0 voices, and was last updated by  ath 14 years, 12 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2537

    khaihar
    Member

    What’s the most basic layout for faxing an ActiveDocument in Word2000 via the Winfax 10.02 printer, in VBA or VB?

    I’ve been trying to take my active document, and send it to a number that’s asked for in a message box.

    I’ve fiddled with the SDK, but can’t ever get to the normal winfax print driver, and pop the number in there.

    Suggestions? Comments? Large Sledgehammers? =)

    -Thanks, Khai

    #4263

    JohnD
    Participant

    here is a sample in VBA with Word 2000.

    This sample code shows how to use Automation to
    ‘ integrate Word & WinFax PRO 9.0x
    ‘ EC 1999

    ‘ THIS CODE WILL WORK WITH WINDOWS 95/98 ONLY
    ‘ THE PRINTER CODE HAS NOT BEED TESTED WITH WINDOWS NT

    ‘ This sample will open a Word document.
    ‘ set some options in Word
    ‘ Print it to the WinFax PRO printer driver
    ‘ and send it immediately without any prompts.

    ‘ Define variable to hold original printer settings.

    Dim OldPrinter As String

    ‘ Define variables to use with WinFax automation.

    Dim strRecipient As String
    Dim strFaxNumber As String

    ‘Open an instance of MS Word
    Dim objWord As Object
    Set objWord = CreateObject(“Word.Application”)
    ‘ Contact Microsoft for list of available
    ‘ methods for Word/Office

    ‘ Have Word appear on the screen?
    objWord.Application.Visible = True

    ‘Open an instance of WinFax
    Dim objWinFaxSend As Object
    Set objWinFaxSend = CreateObject(“WinFax.SDKSend8.0”)
    objWinFaxSend.SetClientID (“Client Name”)

    ‘Open temp file set font and setup page
    objWord.Application.Documents.Open “F:somefile.doc”

    ‘ change the font , size etc.
    objWord.Application.Selection.WholeStory
    objWord.Application.Selection.Font.Name = “Courier New”
    objWord.Application.Selection.Font.Size = 8

    ‘ Set to landscape option
    ‘ objWord.ActiveDocument.PageSetup.Orientation = wdOrientLandscape

    ‘Begin Recipient Settings

    strRecipient = “Symantec Corporation”
    strFaxNumber = “416-555-2323”

    ‘ RetCode = objWinFaxSend.LeaveRunning()

    RetCode = objWinFaxSend.SetTo(strRecipient)
    RetCode = objWinFaxSend.SetNumber(strFaxNumber)

    ‘ Begin Job Settings

    ‘ RetCode = objWinFaxSend.ResetGeneralSettings()
    RetCode = objWinFaxSend.SetResolution(1)
    RetCode = objWinFaxSend.SetDeleteAfterSend(1)
    RetCode = objWinFaxSend.SetUseCover(1)
    ‘ RetCode = objWinFaxSend.SetQuickCover(1)
    RetCode = objWinFaxSend.SetCoverText(“Hello this is a test”)
    RetCode = objWinFaxSend.SetCoverFile(“c:program filessymantectalkworkscoverbasic1.cvp”)

    RetCode = objWinFaxSend.AddRecipient()

    RetCode = objWinFaxSend.SetPrintFromApp(1)

    RetCode = objWinFaxSend.Send(1)

    RetCode = objWinFaxSend.ShowSendScreen(0)

    ‘ this routine waits until “IsReadyToPrint” returns a Non-zero
    ‘ value (ready)
    ‘ this loop will wait but allow background
    ‘ processing to continue

    Do While objWinFaxSend.IsReadyToPrint = 0
    DoEvents
    Loop

    ‘ Get the original printer settings before altering them.
    OldPrinter = objWord.Application.ActivePrinter

    ‘ Set the active printer to WinFax PRO printer driver.
    ‘ NOT TESTED WITH WINDOWS NT. (may not print properly)

    ‘ make sure that the port for WinFax is set to FaxModem, or
    ‘ change this accordingly

    objWord.Application.ActivePrinter = “WinFax on FaxModem”

    ‘ print the current document in Word to WinFax.
    objWord.Application.PrintOut

    ‘ Set Printer back to original settings.
    objWord.Application.ActivePrinter = OldPrinter

    ‘ Wait until the EntryID is ready before moving on.
    ‘ the Send(1) you specified before is used here.
    ‘ We don’t care what the EntryID is,
    ‘ we just want to know that is it ready.
    ‘ this loop will wait but allow background processing to continue
    ‘ when ready IsEntryIDReady is not = to 1

    Do While objWinFaxSend.IsEntryIDReady(0) <> 1
    DoEvents
    Loop

    ‘Close temp file and set winfax object instance to nothing

    objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges

    ‘ Close instance of MS Word
    objWord.Application.Quit SaveChanges:=wdDoNotSaveChanges

    ‘ Close it down.
    Set objWord = Nothing
    Set objWinFaxSend = Nothing

    #4264

    ath
    Member

    I need help on this too. I have used this code and replaced the area that prints the document to print the active document.

    Application.ActiveDocument.PrintOut

    Its seems that the code is just looping, once I hit stop the winfax send dialog opens but none of the recipent info is there.

    Does anyone know how to send the Active document to winfax automatically with the number going through. The number is hardcoded.

    Help

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.